diff --git a/clippy_lints/src/attrs.rs b/clippy_lints/src/attrs.rs index 8025832fdcc..66a1d72ec2d 100644 --- a/clippy_lints/src/attrs.rs +++ b/clippy_lints/src/attrs.rs @@ -208,7 +208,8 @@ impl LintPass for AttrPass { impl<'a, 'tcx> LateLintPass<'a, 'tcx> for AttrPass { fn check_attribute(&mut self, cx: &LateContext<'a, 'tcx>, attr: &'tcx Attribute) { if let Some(items) = &attr.meta_item_list() { - match &*attr.name().as_str() { + if let Some(ident) = attr.ident_str() { + match ident { "allow" | "warn" | "deny" | "forbid" => { check_clippy_lint_names(cx, items); }, @@ -229,6 +230,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for AttrPass { } } } + } fn check_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx Item) { if is_relevant_item(cx.tcx, item) { @@ -240,7 +242,8 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for AttrPass { for attr in &item.attrs { if let Some(lint_list) = &attr.meta_item_list() { - match &*attr.name().as_str() { + if let Some(ident) = attr.ident_str() { + match ident { "allow" | "warn" | "deny" | "forbid" => { // whitelist `unused_imports` and `deprecated` for `use` items // and `unused_imports` for `extern crate` items with `macro_use` @@ -288,6 +291,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for AttrPass { } } } + } }, _ => {}, } diff --git a/clippy_lints/src/missing_doc.rs b/clippy_lints/src/missing_doc.rs index f5dab6d1fed..1cff51d1948 100644 --- a/clippy_lints/src/missing_doc.rs +++ b/clippy_lints/src/missing_doc.rs @@ -58,7 +58,7 @@ impl MissingDoc { if let Some(meta) = meta; if let MetaItemKind::List(list) = meta.node; if let Some(meta) = list.get(0); - if let Some(name) = meta.name(); + if let Some(name) = meta.ident_str(); then { name == "include" } else {