diff --git a/src/expr.rs b/src/expr.rs index a88e7ee6d19..057a0ef1056 100644 --- a/src/expr.rs +++ b/src/expr.rs @@ -137,14 +137,14 @@ impl Rewrite for ast::Expr { Some(ident) => format!(" {}", ident.node), None => String::new(), }; - Some(format!("continue{}", id_str)) + wrap_str(format!("continue{}", id_str), context.config.max_width, width, offset) } ast::ExprKind::Break(ref opt_ident) => { let id_str = match *opt_ident { Some(ident) => format!(" {}", ident.node), None => String::new(), }; - Some(format!("break{}", id_str)) + wrap_str(format!("break{}", id_str), context.config.max_width, width, offset) } ast::ExprKind::Closure(capture, ref fn_decl, ref body) => { rewrite_closure(capture, fn_decl, body, self.span, context, width, offset) diff --git a/tests/source/issue-855.rs b/tests/source/issue-855.rs new file mode 100644 index 00000000000..8f33fa685ae --- /dev/null +++ b/tests/source/issue-855.rs @@ -0,0 +1,20 @@ +fn main() { + 'running: loop { + for event in event_pump.poll_iter() { + match event { + Event::Quit {..} | Event::KeyDown { keycode: Some(Keycode::Escape), .. } => break 'running, + } + } + } +} + +fn main2() { + 'running: loop { + for event in event_pump.poll_iter() { + match event { + Event::Quit {..} | + Event::KeyDownXXXXXXXXXXXXX { keycode: Some(Keycode::Escape), .. } => break 'running, + } + } + } +} diff --git a/tests/target/issue-855.rs b/tests/target/issue-855.rs new file mode 100644 index 00000000000..3add3378ff7 --- /dev/null +++ b/tests/target/issue-855.rs @@ -0,0 +1,23 @@ +fn main() { + 'running: loop { + for event in event_pump.poll_iter() { + match event { + Event::Quit { .. } | + Event::KeyDown { keycode: Some(Keycode::Escape), .. } => break 'running, + } + } + } +} + +fn main2() { + 'running: loop { + for event in event_pump.poll_iter() { + match event { + Event::Quit { .. } | + Event::KeyDownXXXXXXXXXXXXX { keycode: Some(Keycode::Escape), .. } => { + break 'running + } + } + } + } +}