rust-clippy/tests/ui/cast_abs_to_unsigned.fixed

9 lines
180 B
Rust
Raw Normal View History

// run-rustfix
#![warn(clippy::cast_abs_to_unsigned)]
fn main() {
let x: i32 = -42;
let y: u32 = x.unsigned_abs();
println!("The absolute value of {} is {}", x, y);
}