From 6b95029f176e5cdaa88de8ca7f5f59fd15a6d850 Mon Sep 17 00:00:00 2001 From: Philipp Krones Date: Tue, 11 Apr 2023 15:31:08 +0200 Subject: Merge commit '83e42a2337dadac915c956d125f1d69132f36425' into clippyup --- src/driver.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/driver.rs b/src/driver.rs index 9e0822404b6..718bc41fb99 100644 --- a/src/driver.rs +++ b/src/driver.rs @@ -130,7 +130,7 @@ impl rustc_driver::Callbacks for ClippyCallbacks { #[allow(rustc::bad_opt_access)] fn config(&mut self, config: &mut interface::Config) { let conf_path = clippy_lints::lookup_conf_file(); - let conf_path_string = if let Ok(Some(path)) = &conf_path { + let conf_path_string = if let Ok((Some(path), _)) = &conf_path { path.to_str().map(String::from) } else { None -- cgit 1.4.1-3-g733a5 From 89f0aaaec60f5e67604fd2f98b1e43500c1a0578 Mon Sep 17 00:00:00 2001 From: Mara Bos Date: Mon, 17 Apr 2023 13:45:11 +0200 Subject: Force -Zflatten-format-args=no in Clippy. --- src/driver.rs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src') diff --git a/src/driver.rs b/src/driver.rs index 718bc41fb99..205905d5091 100644 --- a/src/driver.rs +++ b/src/driver.rs @@ -160,6 +160,9 @@ impl rustc_driver::Callbacks for ClippyCallbacks { // MIR passes can be enabled / disabled separately, we should figure out, what passes to // use for Clippy. config.opts.unstable_opts.mir_opt_level = Some(0); + + // Disable flattening and inlining of format_args!(), so the HIR matches with the AST. + config.opts.unstable_opts.flatten_format_args = false; } } -- cgit 1.4.1-3-g733a5 From 4a76b6f04f9731ab1c106f33a1023658e7d06107 Mon Sep 17 00:00:00 2001 From: blyxyas Date: Tue, 25 Apr 2023 00:14:26 +0200 Subject: Add the warning to all documentation. --- README.md | 3 ++- book/src/usage.md | 3 ++- lintcheck/README.md | 4 +++- src/main.rs | 2 +- 4 files changed, 8 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/README.md b/README.md index 85798e0e80c..6745e15c006 100644 --- a/README.md +++ b/README.md @@ -91,7 +91,8 @@ cargo clippy #### Automatically applying Clippy suggestions -Clippy can automatically apply some lint suggestions, just like the compiler. +Clippy can automatically apply some lint suggestions, just like the compiler. Note that `--fix` implies +`--all-targets`, so it can fix as much code as it can. ```terminal cargo clippy --fix diff --git a/book/src/usage.md b/book/src/usage.md index 32084a9199b..36448e4cccf 100644 --- a/book/src/usage.md +++ b/book/src/usage.md @@ -111,7 +111,8 @@ fn main() { ### Automatically applying Clippy suggestions -Clippy can automatically apply some lint suggestions, just like the compiler. +Clippy can automatically apply some lint suggestions, just like the compiler. Note that `--fix` implies +`--all-targets`, so it can fix as much code as it can. ```terminal cargo clippy --fix diff --git a/lintcheck/README.md b/lintcheck/README.md index faf3ce9093a..37cc0453809 100644 --- a/lintcheck/README.md +++ b/lintcheck/README.md @@ -79,9 +79,11 @@ is explicitly specified in the options. ### Fix mode You can run `cargo lintcheck --fix` which will run Clippy with `--fix` and -print a warning if Clippy's suggestions fail to apply (if the resulting code does not build). +print a warning if Clippy's suggestions fail to apply (if the resulting code does not build). This lets us spot bad suggestions or false positives automatically in some cases. +> Note: Fix mode implies `--all-targets`, so it can fix as much code as it can. + 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. diff --git a/src/main.rs b/src/main.rs index c5e9b96cf3f..188ff87abfc 100644 --- a/src/main.rs +++ b/src/main.rs @@ -13,7 +13,7 @@ Usage: Common options: --no-deps Run Clippy only on the given crate, without linting the dependencies - --fix Automatically apply lint suggestions. This flag implies `--no-deps` + --fix Automatically apply lint suggestions. This flag implies `--no-deps` and `--all-targets` -h, --help Print this message -V, --version Print version info and exit --explain LINT Print the documentation for a given lint -- cgit 1.4.1-3-g733a5