Skip to content

Commit aa08c39

Browse files
committed
Auto merge of rust-lang#5458 - phansch:is-proc-macro-attr, r=matthiaskrgr
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 changelog: none
2 parents 54344c7 + e47db67 commit aa08c39

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

clippy_lints/src/utils/attrs.rs

+2-8
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
use rustc_ast::ast;
2+
use rustc_ast::expand::is_proc_macro_attr;
23
use rustc_errors::Applicability;
34
use rustc_session::Session;
45
use std::str::FromStr;
@@ -123,12 +124,5 @@ fn parse_attrs<F: FnMut(u64)>(sess: &Session, attrs: &[ast::Attribute], name: &'
123124
/// Return true if the attributes contain any of `proc_macro`,
124125
/// `proc_macro_derive` or `proc_macro_attribute`, false otherwise
125126
pub fn is_proc_macro(attrs: &[ast::Attribute]) -> bool {
126-
use rustc_span::Symbol;
127-
128-
let syms = [
129-
Symbol::intern("proc_macro"),
130-
Symbol::intern("proc_macro_derive"),
131-
Symbol::intern("proc_macro_attribute"),
132-
];
133-
attrs.iter().any(|attr| syms.iter().any(move |&s| attr.check_name(s)))
127+
attrs.iter().any(is_proc_macro_attr)
134128
}

0 commit comments

Comments
 (0)