Fix: #2604, Fix: #2240, Fix: #2341, Fix #1355 - Better error handling and and spaces handling in autofmt (#2736)

* add new autofmt sample
* Feat: implement rustfmt::skip support for rsx
* generally improve error handling with better expect messages
* wip: nested rsx formatting and expression formatting
* nested rsx formatting works
* collapse autofmt crate
* cast indent through macros
* use proper whitespace
* no more eating comments!
* Use proper error handling
This commit is contained in:
Jonathan Kelley authored and GitHub committed 2024-07-30 18:36:13 -07:00
1 parent ef0202f999
commit 828cc502f1
47 files changed
+1621 -1055

No files matched your search

+4 -2
View File
@@ -1,7 +1,7 @@
use super::*;
use location::DynIdx;
use proc_macro2::TokenStream as TokenStream2;
use syn::{braced, Expr, Pat};
use syn::{braced, token::Brace, Expr, Pat};
#[non_exhaustive]
#[derive(PartialEq, Eq, Clone, Debug)]
@@ -10,6 +10,7 @@ pub struct ForLoop {
pub pat: Pat,
pub in_token: Token![in],
pub expr: Box<Expr>,
pub brace: Brace,
pub body: TemplateBody,
pub dyn_idx: DynIdx,
}
@@ -24,13 +25,14 @@ impl Parse for ForLoop {
let expr = input.call(Expr::parse_without_eager_brace)?;
let content;
let _brace = braced!(content in input);
let brace = braced!(content in input);
let body = content.parse()?;
Ok(Self {
for_token,
pat,
in_token,
brace,
expr: Box::new(expr),
body,
dyn_idx: DynIdx::default(),