From e47db677acca8fbf3b1c219e65adf426538d9440 Mon Sep 17 00:00:00 2001 From: Philipp Hansch Date: Mon, 13 Apr 2020 09:33:00 +0200 Subject: [PATCH] Cleanup: Use rustc's is_proc_macro_attr It's doing exactly the same: https://doc.rust-lang.org/nightly/nightly-rustc/src/rustc_ast/expand/mod.rs.html#8-12 --- clippy_lints/src/utils/attrs.rs | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/clippy_lints/src/utils/attrs.rs b/clippy_lints/src/utils/attrs.rs index e27e1b7f2..104ea7de5 100644 --- a/clippy_lints/src/utils/attrs.rs +++ b/clippy_lints/src/utils/attrs.rs @@ -1,4 +1,5 @@ use rustc_ast::ast; +use rustc_ast::expand::is_proc_macro_attr; use rustc_errors::Applicability; use rustc_session::Session; use std::str::FromStr; @@ -123,12 +124,5 @@ fn parse_attrs(sess: &Session, attrs: &[ast::Attribute], name: &' /// Return true if the attributes contain any of `proc_macro`, /// `proc_macro_derive` or `proc_macro_attribute`, false otherwise pub fn is_proc_macro(attrs: &[ast::Attribute]) -> bool { - use rustc_span::Symbol; - - let syms = [ - Symbol::intern("proc_macro"), - Symbol::intern("proc_macro_derive"), - Symbol::intern("proc_macro_attribute"), - ]; - attrs.iter().any(|attr| syms.iter().any(move |&s| attr.check_name(s))) + attrs.iter().any(is_proc_macro_attr) }