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:
1 parent
ef0202f999
commit
828cc502f1
47 files changed
+1621
-1055
No files matched your search
@@ -17,12 +17,6 @@ pub struct IfmtInput {
|
||||
pub segments: Vec<Segment>,
|
||||
}
|
||||
|
||||
impl Default for IfmtInput {
|
||||
fn default() -> Self {
|
||||
Self::new(Span::call_site())
|
||||
}
|
||||
}
|
||||
|
||||
impl IfmtInput {
|
||||
pub fn new(span: Span) -> Self {
|
||||
Self {
|
||||
@@ -213,7 +207,7 @@ impl ToTokens for IfmtInput {
|
||||
fn to_tokens(&self, tokens: &mut TokenStream) {
|
||||
// If the input is a string literal, we can just return it
|
||||
if let Some(static_str) = self.to_static() {
|
||||
return static_str.to_tokens(tokens);
|
||||
return quote_spanned! { self.span() => #static_str }.to_tokens(tokens);
|
||||
}
|
||||
|
||||
// Try to turn it into a single _.to_string() call
|
||||
|
||||
Reference in new issue
Block a user