1
Fork 0

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:
Nick Cameron 2015-08-16 16:43:59 +12:00
parent ae1eec81af
commit 81f2e449d7
4 changed files with 20 additions and 1 deletions

View file

@ -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(),
}
}