about summary refs log tree commit diff
path: root/compiler/rustc_lint/src
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2022-10-23 08:14:33 +0200
committerGitHub <noreply@github.com>2022-10-23 08:14:33 +0200
commit6be917a748a507cbbdf156a16ba410b332f0180c (patch)
treed42e58f0041835a1730d545baecdec35597ce2ba /compiler/rustc_lint/src
parent0c146d71fb6864ada3d30bfb1a6da918f7c56c79 (diff)
parent62b65b5edeaf87a7889c84c61218878f4849e8da (diff)
downloadrust-6be917a748a507cbbdf156a16ba410b332f0180c.tar.gz
rust-6be917a748a507cbbdf156a16ba410b332f0180c.zip
Rollup merge of #103399 - smoelius:unknown-lint-maybe-incorrect, r=fee1-dead
Change `unknown_lint` applicability to `MaybeIncorrect`

This small PR changes the applicability of `unknown_lint` to `MaybeIncorrect`, because the suggested lint might not be the correct one.

Here is one example where the current applicability causes a problem. Clippy has a set of internal lints guarded by a feature called `internal`. If the feature is not enabled, then the internal lints are "unknown." In that case, running `cargo clippy --fix ...` on `clippy_utils` causes lines such as the followig
https://github.com/rust-lang/rust/blob/26c96e341639102afacbbcad0dc18ad0ac71ab18/src/tools/clippy/clippy_utils/src/paths.rs#L51-L52
to be changed to
```rust
 #[expect(clippy::invalid_regex)] // internal lints do not know about all external crates
 pub const FUTURES_IO_ASYNCREADEXT: [&str; 3] = ["futures_util", "io", "AsyncReadExt"];
```
which is not correct.
Diffstat (limited to 'compiler/rustc_lint/src')
-rw-r--r--compiler/rustc_lint/src/levels.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler/rustc_lint/src/levels.rs b/compiler/rustc_lint/src/levels.rs
index d3879ff487d..db0a3419e6a 100644
--- a/compiler/rustc_lint/src/levels.rs
+++ b/compiler/rustc_lint/src/levels.rs
@@ -960,7 +960,7 @@ impl<'s, P: LintLevelsProvider> LintLevelsBuilder<'s, P> {
                                         sp,
                                         "did you mean",
                                         suggestion,
-                                        Applicability::MachineApplicable,
+                                        Applicability::MaybeIncorrect,
                                     );
                                 }
                                 lint