mirror of
https://github.com/rust-lang/rust.git
synced 2024-10-31 22:41:50 +00:00
14 lines
554 B
Rust
14 lines
554 B
Rust
fn main() {
|
|
let u = 5 as bool; //~ ERROR cannot cast as `bool`
|
|
//~| HELP compare with zero instead
|
|
//~| SUGGESTION 5 != 0
|
|
|
|
let t = (1 + 2) as bool; //~ ERROR cannot cast as `bool`
|
|
//~| HELP compare with zero instead
|
|
//~| SUGGESTION (1 + 2) != 0
|
|
|
|
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
|
|
}
|