]> git.lizzy.rs Git - rust.git/blob - src/tools/clippy/clippy_dev/src/setup/mod.rs
Rollup merge of #85001 - CDirkx:bytestring, r=JohnTitor
[rust.git] / src / tools / clippy / clippy_dev / src / setup / mod.rs
1 pub mod git_hook;
2 pub mod intellij;
3 pub mod vscode;
4
5 use std::path::Path;
6
7 const CLIPPY_DEV_DIR: &str = "clippy_dev";
8
9 /// This function verifies that the tool is being executed in the clippy directory.
10 /// This is useful to ensure that setups only modify Clippys resources. The verification
11 /// is done by checking that `clippy_dev` is a sub directory of the current directory.
12 ///
13 /// It will print an error message and return `false` if the directory could not be
14 /// verified.
15 fn verify_inside_clippy_dir() -> bool {
16     let path = Path::new(CLIPPY_DEV_DIR);
17     if path.exists() && path.is_dir() {
18         true
19     } else {
20         eprintln!("error: unable to verify that the working directory is clippys directory");
21         false
22     }
23 }