provide suggestion for invalid boolean cast

Also, don't suggest comparing to zero for non-numeric expressions.
This commit is contained in:
Andy Russell 2019-01-09 16:57:49 -05:00
parent 6ecad33838
commit 565c39de43
No known key found for this signature in database
GPG key ID: BE2221033EDBC374
7 changed files with 48 additions and 25 deletions

View file

@ -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