diff --git a/clippy_dev/src/fmt.rs b/clippy_dev/src/fmt.rs index 4d0fdadbd85..a26d6aba10d 100644 --- a/clippy_dev/src/fmt.rs +++ b/clippy_dev/src/fmt.rs @@ -54,6 +54,7 @@ pub fn run(check: bool, verbose: bool) { success &= cargo_fmt(context, project_root.as_path())?; success &= cargo_fmt(context, &project_root.join("clippy_dev"))?; success &= cargo_fmt(context, &project_root.join("rustc_tools_util"))?; + success &= cargo_fmt(context, &project_root.join("lintcheck"))?; for entry in WalkDir::new(project_root.join("tests")) { let entry = entry?; diff --git a/lintcheck/README.md b/lintcheck/README.md index 68dbf564014..983f59efdbd 100644 --- a/lintcheck/README.md +++ b/lintcheck/README.md @@ -67,3 +67,9 @@ is checked. **Note:** `-Wclippy::all` is always enabled by default, unless `-Aclippy::all` is explicitly specified in the options. + +### Fix mode +You can run `./lintcheck/target/debug/lintcheck --fix` which will run Clippy with `-Zunstable-options --fix` and print a warning if Clippys suggestions fail to apply (if the resulting code does not build). +This lets us spot bad suggestions or false positives automatically in some cases. + +Please note that the target dir should be cleaned afterwards since clippy will modify the downloaded sources which can lead to unexpected results when running lintcheck again afterwards. \ No newline at end of file diff --git a/lintcheck/src/main.rs b/lintcheck/src/main.rs index 1964afd3609..4028be0bf65 100644 --- a/lintcheck/src/main.rs +++ b/lintcheck/src/main.rs @@ -862,7 +862,11 @@ fn get_clap_config<'a>() -> ArgMatches<'a> { .long("jobs") .help("number of threads to use, 0 automatic choice"), ) - .arg(Arg::with_name("fix").help("runs cargo clippy --fix and checks if all suggestions apply")) + .arg( + Arg::with_name("fix") + .long("--fix") + .help("runs cargo clippy --fix and checks if all suggestions apply"), + ) .get_matches() }