Content-Length: 23961 | pFad | https://doc.rust-lang.org/std/string/../error/../string/../cmp/../../error_codes/./E0054.html

E0054 - Error codes index

Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Error code E0054

It is not allowed to cast to a bool.

Erroneous code example:

#![allow(unused)]
fn main() {
let x = 5;

// Not allowed, won't compile
let x_is_nonzero = x as bool;
}

If you are trying to cast a numeric type to a bool, you can compare it with zero instead:

#![allow(unused)]
fn main() {
let x = 5;

// Ok
let x_is_nonzero = x != 0;
}








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: https://doc.rust-lang.org/std/string/../error/../string/../cmp/../../error_codes/./E0054.html

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy