diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2021-03-11 15:18:56 +0100 |
|---|---|---|
| committer | Matthias Krüger <matthias.krueger@famsik.de> | 2021-03-11 15:27:30 +0100 |
| commit | b068b742ee9dac585cdaf781a09bbdabba9c27a4 (patch) | |
| tree | 1a222e0f81ee341824dde0022721edd46451f55b | |
| parent | b29ef183fb9b8a25c4a904d63428c8e37dd9696b (diff) | |
| download | rust-b068b742ee9dac585cdaf781a09bbdabba9c27a4.tar.gz rust-b068b742ee9dac585cdaf781a09bbdabba9c27a4.zip | |
lintcheck: fix --fix and document it in the readme.
also hook lintcheck into clippy-dev so that `clippy dev fmt` formats it.
| -rw-r--r-- | clippy_dev/src/fmt.rs | 1 | ||||
| -rw-r--r-- | lintcheck/README.md | 6 | ||||
| -rw-r--r-- | lintcheck/src/main.rs | 6 |
3 files changed, 12 insertions, 1 deletions
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() } |
