Skip to content

Commit

Permalink
Cleanup: Use rustc's is_proc_macro_attr
Browse files Browse the repository at this point in the history
  • Loading branch information
phansch committed Apr 13, 2020
1 parent e29d550 commit e47db67
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions 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;
Expand Down Expand Up @@ -123,12 +124,5 @@ fn parse_attrs<F: FnMut(u64)>(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)
}

0 comments on commit e47db67

Please sign in to comment.