provide suggestion for invalid boolean cast
Also, don't suggest comparing to zero for non-numeric expressions.
This commit is contained in:
parent
6ecad33838
commit
565c39de43
7 changed files with 48 additions and 25 deletions
|
|
@ -2,9 +2,7 @@ error[E0054]: cannot cast as `bool`
|
|||
--> $DIR/E0054.rs:3:24
|
||||
|
|
||||
LL | let x_is_nonzero = x as bool; //~ ERROR E0054
|
||||
| ^^^^^^^^^ unsupported cast
|
||||
|
|
||||
= help: compare with zero instead
|
||||
| ^^^^^^^^^ help: compare with zero instead: `x != 0`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue