From 6afb0e856cd78fd932f3ee363757be0573c94098 Mon Sep 17 00:00:00 2001 From: Seiichi Uchida Date: Sun, 18 Jun 2017 02:35:18 +0900 Subject: [PATCH] Avoid line break when rhs of assignment is an invalid macro --- src/expr.rs | 12 +----------- tests/source/macros.rs | 6 ++++++ tests/target/macros.rs | 6 ++++++ 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/src/expr.rs b/src/expr.rs index b69e8bbd42e..5fdc03bcc8e 100644 --- a/src/expr.rs +++ b/src/expr.rs @@ -2719,17 +2719,7 @@ pub fn rewrite_assign_rhs>( }; // 1 = space between operator and rhs. let orig_shape = try_opt!(shape.offset_left(last_line_width + 1)); - let rhs = match ex.node { - ast::ExprKind::Mac(ref mac) => { - match rewrite_macro(mac, None, context, orig_shape, MacroPosition::Expression) { - None if !context.snippet(ex.span).contains("\n") => { - context.snippet(ex.span).rewrite(context, orig_shape) - } - rhs @ _ => rhs, - } - } - _ => ex.rewrite(context, orig_shape), - }; + let rhs = ex.rewrite(context, orig_shape); fn count_line_breaks(src: &str) -> usize { src.chars().filter(|&x| x == '\n').count() diff --git a/tests/source/macros.rs b/tests/source/macros.rs index a890053359f..e9c87f3ccea 100644 --- a/tests/source/macros.rs +++ b/tests/source/macros.rs @@ -79,6 +79,12 @@ fn main() { not function like ); + // #1712 + let image = gray_image!( + 00, 01, 02; + 10, 11, 12; + 20, 21, 22); + // #1577 let json = json!({ "foo": "bar", diff --git a/tests/target/macros.rs b/tests/target/macros.rs index 9cc3305ea39..a9522fc26ce 100644 --- a/tests/target/macros.rs +++ b/tests/target/macros.rs @@ -110,6 +110,12 @@ fn main() { not function like ); + // #1712 + let image = gray_image!( + 00, 01, 02; + 10, 11, 12; + 20, 21, 22); + // #1577 let json = json!({ "foo": "bar",