-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Closed
Labels
A-lintArea: New lintsArea: New lints
Description
What it does
The lint suggest to replace a FP::powf() call with a different method call.
Lint Name
use_cube_root_function
Category
perf
Advantage
It's more precise, shorter and simpler.
Drawbacks
None, I think.
Example
#![warn(clippy::all)]
#![warn(clippy::nursery)]
#![warn(clippy::pedantic)]
fn main() {
println!("{}", 1.5_f64.powf(1.0 / 3.0));
}
Could be written as:
#![warn(clippy::all)]
#![warn(clippy::nursery)]
#![warn(clippy::pedantic)]
fn main() {
println!("{}", 1.5_f64.cbrt());
}
Also note that they output slightly different results. cbrt is more precise.
Metadata
Metadata
Assignees
Labels
A-lintArea: New lintsArea: New lints