Skip to content

Commit 0014735

Browse files
committed
Call Arc::clone rather than .clone() to make clippy happy
1 parent 82d8890 commit 0014735

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

compiler/rustc_expand/src/mbe/macro_rules.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -628,11 +628,12 @@ pub fn compile_declarative_macro(
628628
// Return the number of rules for unused rule linting, if this is a local macro.
629629
let nrules = if is_defined_in_current_crate(node_id) { rules.len() } else { 0 };
630630

631-
let expander =
632-
Arc::new(MacroRulesMacroExpander { name: ident, span, node_id, transparency, rules });
633-
let opt_attr_ext =
634-
has_attr_rules.then(|| Arc::new(mk_syn_ext(SyntaxExtensionKind::Attr(expander.clone()))));
635-
(mk_bang_ext(expander), opt_attr_ext, nrules)
631+
let exp = Arc::new(MacroRulesMacroExpander { name: ident, span, node_id, transparency, rules });
632+
let opt_attr_ext = has_attr_rules.then(|| {
633+
let exp = Arc::clone(&exp);
634+
Arc::new(mk_syn_ext(SyntaxExtensionKind::Attr(exp)))
635+
});
636+
(mk_bang_ext(exp), opt_attr_ext, nrules)
636637
}
637638

638639
fn check_no_eof(sess: &Session, p: &Parser<'_>, msg: &'static str) -> Option<ErrorGuaranteed> {

0 commit comments

Comments
 (0)