소스 검색

Merge pull request #1420 from ealmloff/only-collect-rsx-macro

Only collect the rsx and render macros in autofmt
Jonathan Kelley 1 년 전
부모
커밋
e799c2efa2
1개의 변경된 파일9개의 추가작업 그리고 1개의 파일을 삭제
  1. 9 1
      packages/autofmt/src/collect_macros.rs

+ 9 - 1
packages/autofmt/src/collect_macros.rs

@@ -17,7 +17,15 @@ struct MacroCollector<'a, 'b> {
 
 impl<'a, 'b> Visit<'b> for MacroCollector<'a, 'b> {
     fn visit_macro(&mut self, i: &'b Macro) {
-        self.macros.push(i);
+        if let Some("rsx" | "render") = i
+            .path
+            .segments
+            .last()
+            .map(|i| i.ident.to_string())
+            .as_deref()
+        {
+            self.macros.push(i)
+        }
     }
 }