diff --git a/packages/autofmt/src/collect_macros.rs b/packages/autofmt/src/collect_macros.rs index b2e99b127..197cafcec 100644 --- a/packages/autofmt/src/collect_macros.rs +++ b/packages/autofmt/src/collect_macros.rs @@ -19,10 +19,9 @@ pub fn collect_from_item<'a>(item: &'a Item, macros: &mut Vec // Ignore macros if they're not rsx or render Item::Macro(macro_) => { - let to_str = macro_.mac.path.segments[0].ident.to_string(); - // let Some(ident) = ¯o_.ident else { return }; - // let to_str = ident.to_string(); - if to_str == "rsx" || to_str == "render" { + if macro_.mac.path.segments[0].ident == "rsx" + || macro_.mac.path.segments[0].ident == "render" + { macros.push(¯o_.mac); } } @@ -43,10 +42,8 @@ pub fn collect_from_item<'a>(item: &'a Item, macros: &mut Vec } // None of these we can really do anything with at the item level - Item::Macro2(m) => { - panic!("Macro2: {:?}", m); - } - Item::Enum(_) + Item::Macro2(_) + | Item::Enum(_) | Item::ExternCrate(_) | Item::ForeignMod(_) | Item::TraitAlias(_) @@ -77,9 +74,9 @@ pub fn collect_from_expr<'a>(expr: &'a Expr, macros: &mut Vec // collect an expr from the exprs, descending into blocks match expr { Expr::Macro(macro_) => { - let macro_name = macro_.mac.path.segments[0].ident.to_string(); - - if macro_name == "rsx" { + if macro_.mac.path.segments[0].ident == "rsx" + || macro_.mac.path.segments[0].ident == "render" + { macros.push(¯o_.mac); } }