File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -106,9 +106,19 @@ impl LateLintPass for AttrPass {
106
106
ItemExternCrate ( _) |
107
107
ItemUse ( _) => {
108
108
for attr in & item. attrs {
109
- if let MetaItemKind :: List ( ref name, _ ) = attr. node . value . node {
109
+ if let MetaItemKind :: List ( ref name, ref lint_list ) = attr. node . value . node {
110
110
match & * * name {
111
111
"allow" | "warn" | "deny" | "forbid" => {
112
+ // whitelist `unused_imports`
113
+ for lint in lint_list {
114
+ if let MetaItemKind :: Word ( ref word) = lint. node {
115
+ if word == "unused_imports" {
116
+ if let ItemUse ( _) = item. node {
117
+ return ;
118
+ }
119
+ }
120
+ }
121
+ }
112
122
if let Some ( mut sugg) = snippet_opt ( cx, attr. span ) {
113
123
if sugg. len ( ) > 1 {
114
124
span_lint_and_then ( cx, USELESS_ATTRIBUTE , attr. span ,
You can’t perform that action at this time.
0 commit comments