mirror of
https://github.com/rust-lang/rust-clippy
synced 2025-02-17 06:28:42 +00:00
lintcheck: fix --fix and document it in the readme.
also hook lintcheck into clippy-dev so that `clippy dev fmt` formats it.
This commit is contained in:
parent
b29ef183fb
commit
b068b742ee
3 changed files with 12 additions and 1 deletions
|
@ -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?;
|
||||
|
|
|
@ -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.
|
|
@ -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()
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue