summary refs log tree commit diff
path: root/src/test/ui/parser
diff options
context:
space:
mode:
authorDylan DPC <99973273+Dylan-DPC@users.noreply.github.com>2022-03-01 03:41:46 +0100
committerGitHub <noreply@github.com>2022-03-01 03:41:46 +0100
commit4bd40d67d85f9e06df87b9f0fdeb9be6784ef427 (patch)
tree2651d22c59331e1768641c68f9c832955bd7f932 /src/test/ui/parser
parent8d6f527530f4ba974d922269267fe89050188789 (diff)
parent5ce3f5664130eaf24d187d04dcd51c4577336ab5 (diff)
downloadrust-4bd40d67d85f9e06df87b9f0fdeb9be6784ef427.tar.gz
rust-4bd40d67d85f9e06df87b9f0fdeb9be6784ef427.zip
Rollup merge of #91545 - compiler-errors:deref-suggestion-improvements, r=estebank
Generalize "remove `&`"  and "add `*`" suggestions to more than one deref

Suggest removing more than one `&` and `&mut`, along with suggesting adding more than one `*` (or a combination of the two).

r? `@estebank`
(since you're experienced with these types of suggestions, feel free to reassign)
Diffstat (limited to 'src/test/ui/parser')
-rw-r--r--src/test/ui/parser/expr-as-stmt-2.stderr5
-rw-r--r--src/test/ui/parser/expr-as-stmt.stderr5
2 files changed, 10 insertions, 0 deletions
diff --git a/src/test/ui/parser/expr-as-stmt-2.stderr b/src/test/ui/parser/expr-as-stmt-2.stderr
index 2b6314c38ce..b7516babc13 100644
--- a/src/test/ui/parser/expr-as-stmt-2.stderr
+++ b/src/test/ui/parser/expr-as-stmt-2.stderr
@@ -36,6 +36,11 @@ LL | /     &&
 LL | |     if let Some(y) = a { true } else { false }
    | |______________________________________________^ expected `bool`, found `&&bool`
    |
+help: consider removing the `&&`
+   |
+LL -     &&
+LL +     if let Some(y) = a { true } else { false }
+   | 
 help: parentheses are required to parse this as an expression
    |
 LL |     (if let Some(x) = a { true } else { false })
diff --git a/src/test/ui/parser/expr-as-stmt.stderr b/src/test/ui/parser/expr-as-stmt.stderr
index df0e4dcb16e..e63da52c8fe 100644
--- a/src/test/ui/parser/expr-as-stmt.stderr
+++ b/src/test/ui/parser/expr-as-stmt.stderr
@@ -170,6 +170,11 @@ LL | fn revenge_from_mars() -> bool {
 LL |     { true } && { true }
    |              ^^^^^^^^^^^ expected `bool`, found `&&bool`
    |
+help: consider removing the `&&`
+   |
+LL -     { true } && { true }
+LL +     { true } { true }
+   | 
 help: parentheses are required to parse this as an expression
    |
 LL |     ({ true }) && { true }