Allow allow(deprecated) attribute on use items

fixes #1372
This commit is contained in:
Wim Looman 2016-12-01 22:36:35 +01:00
parent f9fe50da1e
commit 919feaaec5
2 changed files with 7 additions and 2 deletions

View file

@ -110,9 +110,9 @@ impl LateLintPass for AttrPass {
if let MetaItemKind::List(ref lint_list) = attr.value.node {
match &*attr.name().as_str() {
"allow" | "warn" | "deny" | "forbid" => {
// whitelist `unused_imports`
// whitelist `unused_imports` and `deprecated`
for lint in lint_list {
if is_word(lint, "unused_imports") {
if is_word(lint, "unused_imports") || is_word(lint, "deprecated") {
if let ItemUse(_) = item.node {
return;
}

View file

@ -11,4 +11,9 @@ extern crate clippy_lints;
#[allow(unused_imports)]
use std::collections;
// don't lint on deprecated for `use` items
mod foo { #[deprecated] pub struct Bar; }
#[allow(deprecated)]
pub use foo::Bar;
fn main() {}