Skip to content

Commit

Permalink
Rollup merge of rust-lang#103399 - smoelius:unknown-lint-maybe-incorr…
Browse files Browse the repository at this point in the history
…ect, 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.
  • Loading branch information
notriddle authored Oct 22, 2022
2 parents 0a7a334 + 62b65b5 commit c2442c3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion compiler/rustc_lint/src/levels.rs
Original file line number Diff line number Diff line change
Expand Up @@ -960,7 +960,7 @@ impl<'s, P: LintLevelsProvider> LintLevelsBuilder<'s, P> {
sp,
"did you mean",
suggestion,
Applicability::MachineApplicable,
Applicability::MaybeIncorrect,
);
}
lint
Expand Down

0 comments on commit c2442c3

Please sign in to comment.