Clippy Example
Example code:
fn main() { let pi = 3.14; let diameter = 1_f64; println!("Circumference: {}", diameter * pi); }
Apply clippy:
play (main #) $ cargo clippy
Checking play v0.1.0 (/Users/joseph/Temp/play)
error: approximate value of `f{32, 64}::consts::PI` found. Consider using it directly
--> src/main.rs:2:14
|
2 | let pi = 3.14;
| ^^^^
|
= note: `#[deny(clippy::approx_constant)]` on by default
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#approx_constant
error: aborting due to previous error
error: could not compile `play`
To learn more, run the command again with --verbose.