2015-07-26 19:31:38 -05:00
|
|
|
fn main() {
|
2019-01-09 15:57:49 -06:00
|
|
|
let u = 5 as bool; //~ ERROR cannot cast as `bool`
|
|
|
|
//~| HELP compare with zero instead
|
|
|
|
//~| SUGGESTION 5 != 0
|
2023-01-14 20:51:52 -06:00
|
|
|
|
2019-01-09 15:57:49 -06:00
|
|
|
let t = (1 + 2) as bool; //~ ERROR cannot cast as `bool`
|
|
|
|
//~| HELP compare with zero instead
|
|
|
|
//~| SUGGESTION (1 + 2) != 0
|
2023-01-14 20:51:52 -06:00
|
|
|
|
|
|
|
let v = "hello" as bool;
|
|
|
|
//~^ ERROR casting `&'static str` as `bool` is invalid
|
|
|
|
//~| HELP consider using the `is_empty` method on `&'static str` to determine if it contains anything
|
2015-07-26 19:31:38 -05:00
|
|
|
}
|