diff --git a/src/expr.rs b/src/expr.rs index face73d72f0..2e526895e25 100644 --- a/src/expr.rs +++ b/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(), } } diff --git a/src/lib.rs b/src/lib.rs index 9ec401b129d..11d9e76bac8 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -11,7 +11,8 @@ #![feature(rustc_private)] #![feature(str_escape)] #![feature(str_char)] - +#![feature(custom_attribute)] +#![allow(unused_attributes)] // TODO we're going to allocate a whole bunch of temp Strings, is it worth // keeping some scratch mem for this and running our own StrPool? @@ -227,6 +228,8 @@ fn fmt_ast(krate: &ast::Crate, codemap: &CodeMap, config: &Config) -> FileMap { // Formatting done on a char by char or line by line basis. // TODO warn on bad license // TODO other stuff for parity with make tidy +// FIXME skipping due to `continue`, #184. +#[rustfmt_skip] fn fmt_lines(file_map: &mut FileMap, config: &Config) -> FormatReport { let mut truncate_todo = Vec::new(); let mut report = FormatReport { file_error_map: HashMap::new() }; diff --git a/tests/source/loop.rs b/tests/source/loop.rs index 36e6ab43de8..c7f7da71831 100644 --- a/tests/source/loop.rs +++ b/tests/source/loop.rs @@ -21,5 +21,8 @@ let x = loop { do_forever(); }; while let Some(i) = x.find('s') { x.update(); + // FIXME #184 + // continue; + // continue 'foo; } } diff --git a/tests/target/loop.rs b/tests/target/loop.rs index fea5bfe2cb2..648fe826e8f 100644 --- a/tests/target/loop.rs +++ b/tests/target/loop.rs @@ -25,5 +25,8 @@ fn main() { while let Some(i) = x.find('s') { x.update(); + // FIXME #184 + // continue; + // continue 'foo; } }