Skip to content

Commit bbb69d1

Browse files
committed
Suggest dereferencing boolean reference when used in 'if' or 'while'
Change-Id: I0c5c4d767be2647e6f017ae7bf83558c56dbca97
1 parent 8a164ac commit bbb69d1

File tree

2 files changed

+2
-40
lines changed

2 files changed

+2
-40
lines changed

src/test/ui/if/if-no-match-bindings.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ LL | while b_mut_ref() {}
7373
error[E0308]: mismatched types
7474
--> $DIR/if-no-match-bindings.rs:26:11
7575
|
76-
26 | while &true {}
76+
LL | while &true {}
7777
| ^^^^^
7878
| |
7979
| expected bool, found &bool
@@ -85,7 +85,7 @@ error[E0308]: mismatched types
8585
error[E0308]: mismatched types
8686
--> $DIR/if-no-match-bindings.rs:27:11
8787
|
88-
27 | while &mut true {}
88+
LL | while &mut true {}
8989
| ^^^^^^^^^
9090
| |
9191
| expected bool, found &mut bool

src/test/ui/rfc-2497-if-let-chains/disallowed-positions.stderr

-38
Original file line numberDiff line numberDiff line change
@@ -513,44 +513,6 @@ warning: the feature `let_chains` is incomplete and may cause the compiler to cr
513513
LL | #![feature(let_chains)] // Avoid inflating `.stderr` with overzealous gates in this test.
514514
| ^^^^^^^^^^
515515

516-
warning: unnecessary parentheses around `if` condition
517-
--> $DIR/disallowed-positions.rs:51:8
518-
|
519-
LL | if (true || let 0 = 0) {}
520-
| ^^^^^^^^^^^^^^^^^^^ help: remove these parentheses
521-
|
522-
= note: `#[warn(unused_parens)]` on by default
523-
524-
warning: unnecessary parentheses around `while` condition
525-
--> $DIR/disallowed-positions.rs:115:11
526-
|
527-
LL | while (true || let 0 = 0) {}
528-
| ^^^^^^^^^^^^^^^^^^^ help: remove these parentheses
529-
530-
wrning: unnecessary parentheses around `let` head expression
531-
--> $DIR/disallowed-positions.rs:160:41
532-
|
533-
LL | if let Range { start: _, end: _ } = (true..true || false) { }
534-
| ^^^^^^^^^^^^^^^^^^^^^ help: remove these parentheses
535-
536-
warning: unnecessary parentheses around `let` head expression
537-
--> $DIR/disallowed-positions.rs:162:41
538-
|
539-
LL | if let Range { start: _, end: _ } = (true..true && false) { }
540-
| ^^^^^^^^^^^^^^^^^^^^^ help: remove these parentheses
541-
542-
warning: unnecessary parentheses around `let` head expression
543-
--> $DIR/disallowed-positions.rs:164:44
544-
|
545-
LL | while let Range { start: _, end: _ } = (true..true || false) { }
546-
| ^^^^^^^^^^^^^^^^^^^^^ help: remove these parentheses
547-
548-
warning: unnecessary parentheses around `let` head expression
549-
--> $DIR/disallowed-positions.rs:166:44
550-
|
551-
LL | while let Range { start: _, end: _ } = (true..true && false) { }
552-
| ^^^^^^^^^^^^^^^^^^^^^ help: remove these parentheses
553-
554516
error[E0308]: mismatched types
555517
--> $DIR/disallowed-positions.rs:32:8
556518
|

0 commit comments

Comments
 (0)