Skip to content

Commit 7bbdeb4

Browse files
committed
Make AttrQuery copyable
1 parent e426796 commit 7bbdeb4

File tree

2 files changed

+15
-10
lines changed

2 files changed

+15
-10
lines changed

crates/ra_hir_def/src/attr.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ impl Attr {
140140
}
141141
}
142142

143+
#[derive(Debug, Clone, Copy)]
143144
pub struct AttrQuery<'a> {
144145
attrs: &'a Attrs,
145146
key: &'static str,

crates/ra_hir_def/src/nameres/raw.rs

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -404,16 +404,20 @@ impl RawItemsCollector {
404404
let ast_id = self.source_ast_id_map.ast_id(&m);
405405

406406
// FIXME: cfg_attr
407-
let export = attrs.by_key("macro_export").exists();
408-
let local_inner =
409-
attrs.by_key("macro_export").tt_values().map(|it| &it.token_trees).flatten().any(
410-
|it| match it {
411-
tt::TokenTree::Leaf(tt::Leaf::Ident(ident)) => {
412-
ident.text.contains("local_inner_macros")
413-
}
414-
_ => false,
415-
},
416-
);
407+
let export_attr = attrs.by_key("macro_export");
408+
409+
let export = export_attr.exists();
410+
let local_inner = if export {
411+
export_attr.tt_values().map(|it| &it.token_trees).flatten().any(|it| match it {
412+
tt::TokenTree::Leaf(tt::Leaf::Ident(ident)) => {
413+
ident.text.contains("local_inner_macros")
414+
}
415+
_ => false,
416+
})
417+
} else {
418+
false
419+
};
420+
417421
let builtin = attrs.by_key("rustc_builtin_macro").exists();
418422

419423
let m = self.raw_items.macros.alloc(MacroData {

0 commit comments

Comments
 (0)