]> git.lizzy.rs Git - rust.git/commitdiff
Avoid line break when rhs of assignment is an invalid macro
authorSeiichi Uchida <topecongiro@localhost.localdomain>
Sat, 17 Jun 2017 17:35:18 +0000 (02:35 +0900)
committertopecongiro <seuchida@gmail.com>
Sun, 18 Jun 2017 05:25:21 +0000 (14:25 +0900)
src/expr.rs
tests/source/macros.rs
tests/target/macros.rs

index b69e8bbd42eaf4b6b5472b7322c494098429139f..5fdc03bcc8eeb32215e0823cfb557850e07b1cf7 100644 (file)
@@ -2719,17 +2719,7 @@ pub fn rewrite_assign_rhs<S: Into<String>>(
         };
     // 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()
index a890053359fcc5f20989438b1ebdde87aaa61d16..e9c87f3ccea12956694e4d32a00f732c801a042d 100644 (file)
@@ -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",
index 9cc3305ea39ce77ae719af2a98d157fc19239c09..a9522fc26cee94a855290ca2ba44c17085b9c995 100644 (file)
@@ -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",