Fix test failures
This commit is contained in:
parent
c95fa8cbe2
commit
19054347ca
3 changed files with 11 additions and 4 deletions
|
@ -130,7 +130,10 @@ fn rewrite_macro_name(path: &ast::Path, extra_ident: Option<ast::Ident>) -> Stri
|
||||||
}
|
}
|
||||||
|
|
||||||
// Use this on failing to format the macro call.
|
// Use this on failing to format the macro call.
|
||||||
fn return_original_snippet_with_failure_marked(context: &RewriteContext, span: Span) -> Option<String> {
|
fn return_original_snippet_with_failure_marked(
|
||||||
|
context: &RewriteContext,
|
||||||
|
span: Span,
|
||||||
|
) -> Option<String> {
|
||||||
context.macro_rewrite_failure.replace(true);
|
context.macro_rewrite_failure.replace(true);
|
||||||
Some(context.snippet(span).to_owned())
|
Some(context.snippet(span).to_owned())
|
||||||
}
|
}
|
||||||
|
@ -225,7 +228,11 @@ pub fn rewrite_macro_inner(
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
None => return return_original_snippet_with_failure_marked(context, mac.span),
|
None => {
|
||||||
|
return return_original_snippet_with_failure_marked(
|
||||||
|
context, mac.span,
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -742,7 +742,7 @@ impl<'b, 'a: 'b> FmtVisitor<'a> {
|
||||||
where
|
where
|
||||||
F: Fn(&RewriteContext) -> Option<String>,
|
F: Fn(&RewriteContext) -> Option<String>,
|
||||||
{
|
{
|
||||||
let mut result;
|
let result;
|
||||||
let macro_rewrite_failure = {
|
let macro_rewrite_failure = {
|
||||||
let context = self.get_context();
|
let context = self.get_context();
|
||||||
result = f(&context);
|
result = f(&context);
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
// Do not unindent macro calls in comment with unformattable syntax.
|
// Do not unindent macro calls in comment with unformattable syntax.
|
||||||
//! ```rust
|
//! ```rust
|
||||||
//! let x = 3;
|
//! let x = 3 ;
|
||||||
//! some_macro!(pub fn fn foo() (
|
//! some_macro!(pub fn fn foo() (
|
||||||
//! println!("Don't unindent me!");
|
//! println!("Don't unindent me!");
|
||||||
//! ));
|
//! ));
|
||||||
|
|
Loading…
Reference in a new issue