Require the use of as _ for indirectly used traits in Clippy sources - #17369
Conversation
|
Some changes occurred in clippy_lints/src/doc cc @notriddle |
|
r? @llogiq rustbot has assigned @llogiq. Use Why was this reviewer chosen?The reviewer was selected based on:
|
as _ for indirectly used traits in Clippy sources
| @@ -4,11 +4,11 @@ use clippy_utils::sugg::Sugg; | |||
| use hir::Param; | |||
| use rustc_errors::Applicability; | |||
| use rustc_hir as hir; | |||
| use rustc_hir::intravisit::{Visitor as HirVisitor, Visitor}; | |||
| use rustc_hir::intravisit::Visitor; | |||
There was a problem hiding this comment.
Surprised this wasn't triggering unused_imports on HirVisitor. I guess the trait's items were being used from HirVisitor (keeping it used), while the trait as a name was used as Visitor? (or vice versa?)
There was a problem hiding this comment.
Multiple imports with renaming don't seem to trigger unused_imports, which makes sense as the import is not unused, just redundant.
50d0d2a to
55eb6c4
Compare
This comment has been minimized.
This comment has been minimized.
55eb6c4 to
17baf7e
Compare
This comment has been minimized.
This comment has been minimized.
17baf7e to
58a4f9c
Compare
This comment has been minimized.
This comment has been minimized.
58a4f9c to
f9d532c
Compare
f9d532c to
15edcdd
Compare
|
This PR was rebased onto a different master commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
|
This is going to make rust-analyzer's auto imports annoying since it doesn't import using
It's a restriction lint. One that might have been pedantic if it were there from the beginning, but still a restriction lint. |
This PR requires
as _in Clippy sources when importing a trait name which is not directly used, as to not pollute the namespace (first commit). It also activate theclippy::unused_trait_namesin dogfood (second commit).changelog: none