Handle span error with continue
This should be properly addressed by #184, but requires a change to the rustc parser, so this patch just works around the issue.
This commit is contained in:
parent
ae1eec81af
commit
81f2e449d7
4 changed files with 20 additions and 1 deletions
10
src/expr.rs
10
src/expr.rs
|
@ -105,6 +105,16 @@ impl Rewrite for ast::Expr {
|
|||
ast::Expr_::ExprPath(ref qself, ref path) => {
|
||||
rewrite_path(context, qself.as_ref(), path, width, offset)
|
||||
}
|
||||
// FIXME #184 Note that this formatting is broken due to a bad span
|
||||
// from the parser.
|
||||
// `continue`
|
||||
ast::Expr_::ExprAgain(ref opt_ident) => {
|
||||
let id_str = match *opt_ident {
|
||||
Some(ident) => format!(" {}", ident),
|
||||
None => String::new(),
|
||||
};
|
||||
Some(format!("continue{}", id_str))
|
||||
}
|
||||
_ => context.codemap.span_to_snippet(self.span).ok(),
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue