about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMazdak Farrokhzad <twingoow@gmail.com>2019-12-04 11:27:11 +0100
committerMazdak Farrokhzad <twingoow@gmail.com>2019-12-20 22:53:40 +0100
commit49826845a9a32a1b0d4e5180e0c6f0bdf06f1196 (patch)
tree04aa8781bcba3cf6a584be3f0a7ca8034552a071
parent19db2d2fed4de5a480bca028458f616d21db92a9 (diff)
downloadrust-49826845a9a32a1b0d4e5180e0c6f0bdf06f1196.tar.gz
rust-49826845a9a32a1b0d4e5180e0c6f0bdf06f1196.zip
use .span_suggestion_short for &&
-rw-r--r--src/librustc_parse/parser/expr.rs4
-rw-r--r--src/test/ui/did_you_mean/issue-54109-and_instead_of_ampersands.stderr16
2 files changed, 10 insertions, 10 deletions
diff --git a/src/librustc_parse/parser/expr.rs b/src/librustc_parse/parser/expr.rs
index 8c66804604f..159c2121d36 100644
--- a/src/librustc_parse/parser/expr.rs
+++ b/src/librustc_parse/parser/expr.rs
@@ -366,9 +366,9 @@ impl<'a> Parser<'a> {
     /// Error on `and` and `or` suggesting `&&` and `||` respectively.
     fn error_bad_logical_op(&self, bad: &str, good: &str, english: &str) {
         self.struct_span_err(self.token.span, &format!("`{}` is not a logical operator", bad))
-            .span_suggestion(
+            .span_suggestion_short(
                 self.token.span,
-                &format!("instead of `{}`, use `{}` to perform logical {}", bad, good, english),
+                &format!("use `{}` to perform logical {}", good, english),
                 good.to_string(),
                 Applicability::MachineApplicable,
             )
diff --git a/src/test/ui/did_you_mean/issue-54109-and_instead_of_ampersands.stderr b/src/test/ui/did_you_mean/issue-54109-and_instead_of_ampersands.stderr
index 62c6204fb6f..528c62f501e 100644
--- a/src/test/ui/did_you_mean/issue-54109-and_instead_of_ampersands.stderr
+++ b/src/test/ui/did_you_mean/issue-54109-and_instead_of_ampersands.stderr
@@ -2,7 +2,7 @@ error: `and` is not a logical operator
   --> $DIR/issue-54109-and_instead_of_ampersands.rs:7:15
    |
 LL |     let _ = a and b;
-   |               ^^^ help: instead of `and`, use `&&` to perform logical conjunction: `&&`
+   |               ^^^ help: use `&&` to perform logical conjunction
    |
    = note: unlike in e.g., python and PHP, `&&` and `||` are used for logical operators
 
@@ -10,7 +10,7 @@ error: `and` is not a logical operator
   --> $DIR/issue-54109-and_instead_of_ampersands.rs:9:10
    |
 LL |     if a and b {
-   |          ^^^ help: instead of `and`, use `&&` to perform logical conjunction: `&&`
+   |          ^^^ help: use `&&` to perform logical conjunction
    |
    = note: unlike in e.g., python and PHP, `&&` and `||` are used for logical operators
 
@@ -18,7 +18,7 @@ error: `or` is not a logical operator
   --> $DIR/issue-54109-and_instead_of_ampersands.rs:20:15
    |
 LL |     let _ = a or b;
-   |               ^^ help: instead of `or`, use `||` to perform logical disjunction: `||`
+   |               ^^ help: use `||` to perform logical disjunction
    |
    = note: unlike in e.g., python and PHP, `&&` and `||` are used for logical operators
 
@@ -26,7 +26,7 @@ error: `or` is not a logical operator
   --> $DIR/issue-54109-and_instead_of_ampersands.rs:22:10
    |
 LL |     if a or b {
-   |          ^^ help: instead of `or`, use `||` to perform logical disjunction: `||`
+   |          ^^ help: use `||` to perform logical disjunction
    |
    = note: unlike in e.g., python and PHP, `&&` and `||` are used for logical operators
 
@@ -34,7 +34,7 @@ error: `and` is not a logical operator
   --> $DIR/issue-54109-and_instead_of_ampersands.rs:30:11
    |
 LL |     if (a and b) {
-   |           ^^^ help: instead of `and`, use `&&` to perform logical conjunction: `&&`
+   |           ^^^ help: use `&&` to perform logical conjunction
    |
    = note: unlike in e.g., python and PHP, `&&` and `||` are used for logical operators
 
@@ -42,7 +42,7 @@ error: `or` is not a logical operator
   --> $DIR/issue-54109-and_instead_of_ampersands.rs:38:11
    |
 LL |     if (a or b) {
-   |           ^^ help: instead of `or`, use `||` to perform logical disjunction: `||`
+   |           ^^ help: use `||` to perform logical disjunction
    |
    = note: unlike in e.g., python and PHP, `&&` and `||` are used for logical operators
 
@@ -50,7 +50,7 @@ error: `and` is not a logical operator
   --> $DIR/issue-54109-and_instead_of_ampersands.rs:46:13
    |
 LL |     while a and b {
-   |             ^^^ help: instead of `and`, use `&&` to perform logical conjunction: `&&`
+   |             ^^^ help: use `&&` to perform logical conjunction
    |
    = note: unlike in e.g., python and PHP, `&&` and `||` are used for logical operators
 
@@ -58,7 +58,7 @@ error: `or` is not a logical operator
   --> $DIR/issue-54109-and_instead_of_ampersands.rs:54:13
    |
 LL |     while a or b {
-   |             ^^ help: instead of `or`, use `||` to perform logical disjunction: `||`
+   |             ^^ help: use `||` to perform logical disjunction
    |
    = note: unlike in e.g., python and PHP, `&&` and `||` are used for logical operators