Skip to content

Commit 6030997

Browse files
committed
Remove verify_inside_clippy_dir since we always set the current directory.
1 parent dcc7906 commit 6030997

File tree

4 files changed

+0
-38
lines changed

4 files changed

+0
-38
lines changed

clippy_dev/src/setup/git_hook.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
use std::fs;
22
use std::path::Path;
33

4-
use super::verify_inside_clippy_dir;
5-
64
/// Rusts setup uses `git rev-parse --git-common-dir` to get the root directory of the repo.
75
/// I've decided against this for the sake of simplicity and to make sure that it doesn't install
86
/// the hook if `clippy_dev` would be used in the rust tree. The hook also references this tool
@@ -35,10 +33,6 @@ pub fn install_hook(force_override: bool) {
3533
}
3634

3735
fn check_precondition(force_override: bool) -> bool {
38-
if !verify_inside_clippy_dir() {
39-
return false;
40-
}
41-
4236
// Make sure that we can find the git repository
4337
let git_path = Path::new(REPO_GIT_DIR);
4438
if !git_path.exists() || !git_path.is_dir() {

clippy_dev/src/setup/mod.rs

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,3 @@ pub mod git_hook;
22
pub mod intellij;
33
pub mod toolchain;
44
pub mod vscode;
5-
6-
use std::path::Path;
7-
8-
const CLIPPY_DEV_DIR: &str = "clippy_dev";
9-
10-
/// This function verifies that the tool is being executed in the clippy directory.
11-
/// This is useful to ensure that setups only modify Clippy's resources. The verification
12-
/// is done by checking that `clippy_dev` is a sub directory of the current directory.
13-
///
14-
/// It will print an error message and return `false` if the directory could not be
15-
/// verified.
16-
fn verify_inside_clippy_dir() -> bool {
17-
let path = Path::new(CLIPPY_DEV_DIR);
18-
if path.exists() && path.is_dir() {
19-
true
20-
} else {
21-
eprintln!("error: unable to verify that the working directory is clippy's directory");
22-
false
23-
}
24-
}

clippy_dev/src/setup/toolchain.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,7 @@ use walkdir::WalkDir;
88

99
use crate::utils::exit_if_err;
1010

11-
use super::verify_inside_clippy_dir;
12-
1311
pub fn create(standalone: bool, force: bool, release: bool, name: &str) {
14-
if !verify_inside_clippy_dir() {
15-
return;
16-
}
17-
1812
let rustup_home = std::env::var("RUSTUP_HOME").unwrap();
1913
let toolchain = std::env::var("RUSTUP_TOOLCHAIN").unwrap();
2014

clippy_dev/src/setup/vscode.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
use std::fs;
22
use std::path::Path;
33

4-
use super::verify_inside_clippy_dir;
5-
64
const VSCODE_DIR: &str = ".vscode";
75
const TASK_SOURCE_FILE: &str = "util/etc/vscode-tasks.json";
86
const TASK_TARGET_FILE: &str = ".vscode/tasks.json";
@@ -22,10 +20,6 @@ pub fn install_tasks(force_override: bool) {
2220
}
2321

2422
fn check_install_precondition(force_override: bool) -> bool {
25-
if !verify_inside_clippy_dir() {
26-
return false;
27-
}
28-
2923
let vs_dir_path = Path::new(VSCODE_DIR);
3024
if vs_dir_path.exists() {
3125
// verify the target will be valid

0 commit comments

Comments
 (0)