1
0
Evan Almloff 1 жил өмнө
parent
commit
6639011a3e

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

@@ -5,8 +5,6 @@
 use proc_macro2::LineColumn;
 use proc_macro2::LineColumn;
 use syn::{Block, Expr, File, Item, Macro, Stmt};
 use syn::{Block, Expr, File, Item, Macro, Stmt};
 
 
-use crate::expr;
-
 type CollectedMacro<'a> = &'a Macro;
 type CollectedMacro<'a> = &'a Macro;
 
 
 pub fn collect_from_file<'a>(file: &'a File, macros: &mut Vec<CollectedMacro<'a>>) {
 pub fn collect_from_file<'a>(file: &'a File, macros: &mut Vec<CollectedMacro<'a>>) {
@@ -44,8 +42,7 @@ pub fn collect_from_item<'a>(item: &'a Item, macros: &mut Vec<CollectedMacro<'a>
         }
         }
 
 
         // None of these we can really do anything with at the item level
         // None of these we can really do anything with at the item level
-        Item::Macro(_)
-        | Item::Enum(_)
+        Item::Enum(_)
         | Item::ExternCrate(_)
         | Item::ExternCrate(_)
         | Item::ForeignMod(_)
         | Item::ForeignMod(_)
         | Item::TraitAlias(_)
         | Item::TraitAlias(_)
@@ -156,7 +153,6 @@ pub fn collect_from_expr<'a>(expr: &'a Expr, macros: &mut Vec<CollectedMacro<'a>
 
 
         // don't both formatting these for now
         // don't both formatting these for now
         Expr::Array(_)
         Expr::Array(_)
-        | Expr::Assign(_)
         | Expr::Await(_)
         | Expr::Await(_)
         | Expr::Binary(_)
         | Expr::Binary(_)
         | Expr::Break(_)
         | Expr::Break(_)

+ 5 - 4
packages/autofmt/src/lib.rs

@@ -88,10 +88,11 @@ pub fn fmt_file(contents: &str) -> Vec<FormattedBlock> {
         }
         }
 
 
         let span = match item.delimiter {
         let span = match item.delimiter {
-            MacroDelimiter::Paren(b) => b.span.open(),
-            MacroDelimiter::Brace(b) => b.span.open(),
-            MacroDelimiter::Bracket(b) => b.span.open(),
-        };
+            MacroDelimiter::Paren(b) => b.span,
+            MacroDelimiter::Brace(b) => b.span,
+            MacroDelimiter::Bracket(b) => b.span,
+        }
+        .join();
 
 
         let mut formatted = String::new();
         let mut formatted = String::new();