about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMazdak Farrokhzad <twingoow@gmail.com>2019-10-14 18:12:04 +0200
committerMazdak Farrokhzad <twingoow@gmail.com>2019-10-14 18:12:04 +0200
commit16266a54058a71c943d064054bfe3a1b5704a444 (patch)
tree87f5fb1c991a76a3f2cf68ff82f7e1bb23ff9d25
parent3a9f8deb1d568baeb2cac503cf8667e3170fb2f8 (diff)
downloadrust-16266a54058a71c943d064054bfe3a1b5704a444.tar.gz
rust-16266a54058a71c943d064054bfe3a1b5704a444.zip
pprust: `p1@p2` -> `p1 @ p2`
-rw-r--r--src/libsyntax/print/pprust.rs3
-rw-r--r--src/test/ui/parser/intersection-patterns.rs4
-rw-r--r--src/test/ui/parser/intersection-patterns.stderr4
3 files changed, 6 insertions, 5 deletions
diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs
index 7d4ffe493d7..68dd90b54ab 100644
--- a/src/libsyntax/print/pprust.rs
+++ b/src/libsyntax/print/pprust.rs
@@ -2381,7 +2381,8 @@ impl<'a> State<'a> {
                 }
                 self.print_ident(ident);
                 if let Some(ref p) = *sub {
-                    self.s.word("@");
+                    self.s.space();
+                    self.s.word_space("@");
                     self.print_pat(p);
                 }
             }
diff --git a/src/test/ui/parser/intersection-patterns.rs b/src/test/ui/parser/intersection-patterns.rs
index 3b0dfd1ee99..adb607cf6b9 100644
--- a/src/test/ui/parser/intersection-patterns.rs
+++ b/src/test/ui/parser/intersection-patterns.rs
@@ -15,7 +15,7 @@ fn main() {
         //~| pattern on the left, should be on the right
         //~| binding on the right, should be on the left
         //~| HELP switch the order
-        //~| SUGGESTION y@Some(x)
+        //~| SUGGESTION y @ Some(x)
         _ => {}
     }
 
@@ -34,7 +34,7 @@ fn main() {
         //~| pattern on the left, should be on the right
         //~| binding on the right, should be on the left
         //~| HELP switch the order
-        //~| SUGGESTION e@1 ..=5
+        //~| SUGGESTION e @ 1 ..=5
         _ => {}
     }
 }
diff --git a/src/test/ui/parser/intersection-patterns.stderr b/src/test/ui/parser/intersection-patterns.stderr
index 39fc9b9475d..f5bfee5bbd6 100644
--- a/src/test/ui/parser/intersection-patterns.stderr
+++ b/src/test/ui/parser/intersection-patterns.stderr
@@ -6,7 +6,7 @@ LL |         Some(x) @ y => {}
    |         |         |
    |         |         binding on the right, should be on the left
    |         pattern on the left, should be on the right
-   |         help: switch the order: `y@Some(x)`
+   |         help: switch the order: `y @ Some(x)`
 
 error: left-hand side of `@` must be a binding
   --> $DIR/intersection-patterns.rs:23:9
@@ -27,7 +27,7 @@ LL |         1 ..= 5 @ e => {}
    |         |         |
    |         |         binding on the right, should be on the left
    |         pattern on the left, should be on the right
-   |         help: switch the order: `e@1 ..=5`
+   |         help: switch the order: `e @ 1 ..=5`
 
 error: aborting due to 3 previous errors