mirror of
https://github.com/rust-lang/rust.git
synced 2025-04-16 05:56:56 +00:00
Better copy for lint message
Since x.log(y) is actually implemented as x.ln() / y.ln()
This commit is contained in:
parent
076ec872ce
commit
f5596826fa
@ -618,7 +618,7 @@ fn check_log_division(cx: &LateContext<'_>, expr: &Expr<'_>) {
|
||||
cx,
|
||||
SUBOPTIMAL_FLOPS,
|
||||
expr.span,
|
||||
"division of logarithms can be calculated more efficiently and accurately",
|
||||
"log base can be expressed more clearly",
|
||||
"consider using",
|
||||
format!("{}.log({})", Sugg::hir(cx, &largs[0], ".."), Sugg::hir(cx, &rargs[0], ".."),),
|
||||
Applicability::MachineApplicable,
|
||||
|
@ -1,4 +1,4 @@
|
||||
error: division of logarithms can be calculated more efficiently and accurately
|
||||
error: log base can be expressed more clearly
|
||||
--> $DIR/floating_point_logbase.rs:7:13
|
||||
|
|
||||
LL | let _ = x.ln() / y.ln();
|
||||
@ -6,19 +6,19 @@ LL | let _ = x.ln() / y.ln();
|
||||
|
|
||||
= note: `-D clippy::suboptimal-flops` implied by `-D warnings`
|
||||
|
||||
error: division of logarithms can be calculated more efficiently and accurately
|
||||
error: log base can be expressed more clearly
|
||||
--> $DIR/floating_point_logbase.rs:8:13
|
||||
|
|
||||
LL | let _ = x.log2() / y.log2();
|
||||
| ^^^^^^^^^^^^^^^^^^^ help: consider using: `x.log(y)`
|
||||
|
||||
error: division of logarithms can be calculated more efficiently and accurately
|
||||
error: log base can be expressed more clearly
|
||||
--> $DIR/floating_point_logbase.rs:9:13
|
||||
|
|
||||
LL | let _ = x.log10() / y.log10();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^ help: consider using: `x.log(y)`
|
||||
|
||||
error: division of logarithms can be calculated more efficiently and accurately
|
||||
error: log base can be expressed more clearly
|
||||
--> $DIR/floating_point_logbase.rs:10:13
|
||||
|
|
||||
LL | let _ = x.log(5f32) / y.log(5f32);
|
||||
|
Loading…
Reference in New Issue
Block a user