Fix useless_attribute
to also whitelist unused_extern_crates
.
This commit is contained in:
parent
9219fc6c5c
commit
85caaf5905
@ -180,10 +180,15 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for AttrPass {
|
||||
|| is_word(lint, "deprecated") {
|
||||
return
|
||||
},
|
||||
ItemKind::ExternCrate(..) => if is_word(lint, "unused_imports")
|
||||
ItemKind::ExternCrate(..) => {
|
||||
if is_word(lint, "unused_imports")
|
||||
&& skip_unused_imports {
|
||||
return
|
||||
},
|
||||
}
|
||||
if is_word(lint, "unused_extern_crates") {
|
||||
return
|
||||
}
|
||||
}
|
||||
_ => {},
|
||||
}
|
||||
}
|
||||
|
@ -2,11 +2,12 @@
|
||||
|
||||
#![warn(clippy::useless_attribute)]
|
||||
|
||||
#[allow(dead_code, unused_extern_crates)]
|
||||
#[cfg_attr(feature = "cargo-clippy", allow(dead_code, unused_extern_crates))]
|
||||
#[allow(dead_code)]
|
||||
#[cfg_attr(feature = "cargo-clippy", allow(dead_code))]
|
||||
#[cfg_attr(feature = "cargo-clippy",
|
||||
allow(dead_code, unused_extern_crates))]
|
||||
allow(dead_code))]
|
||||
#[allow(unused_imports)]
|
||||
#[allow(unused_extern_crates)]
|
||||
#[macro_use]
|
||||
extern crate clippy_lints;
|
||||
|
||||
|
@ -1,16 +1,16 @@
|
||||
error: useless lint attribute
|
||||
--> $DIR/useless_attribute.rs:5:1
|
||||
|
|
||||
5 | #[allow(dead_code, unused_extern_crates)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: if you just forgot a `!`, use: `#![allow(dead_code, unused_extern_crates)]`
|
||||
5 | #[allow(dead_code)]
|
||||
| ^^^^^^^^^^^^^^^^^^^ help: if you just forgot a `!`, use: `#![allow(dead_code)]`
|
||||
|
|
||||
= note: `-D clippy::useless-attribute` implied by `-D warnings`
|
||||
|
||||
error: useless lint attribute
|
||||
--> $DIR/useless_attribute.rs:6:1
|
||||
|
|
||||
6 | #[cfg_attr(feature = "cargo-clippy", allow(dead_code, unused_extern_crates))]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: if you just forgot a `!`, use: `#![cfg_attr(feature = "cargo-clippy", allow(dead_code, unused_extern_crates))`
|
||||
6 | #[cfg_attr(feature = "cargo-clippy", allow(dead_code))]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: if you just forgot a `!`, use: `#![cfg_attr(feature = "cargo-clippy", allow(dead_code))`
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user