Skip to content

Commit f559682

Browse files
committed
Better copy for lint message
Since x.log(y) is actually implemented as x.ln() / y.ln()
1 parent 076ec87 commit f559682

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

clippy_lints/src/floating_point_arithmetic.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -618,7 +618,7 @@ fn check_log_division(cx: &LateContext<'_>, expr: &Expr<'_>) {
618618
cx,
619619
SUBOPTIMAL_FLOPS,
620620
expr.span,
621-
"division of logarithms can be calculated more efficiently and accurately",
621+
"log base can be expressed more clearly",
622622
"consider using",
623623
format!("{}.log({})", Sugg::hir(cx, &largs[0], ".."), Sugg::hir(cx, &rargs[0], ".."),),
624624
Applicability::MachineApplicable,

tests/ui/floating_point_logbase.stderr

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
1-
error: division of logarithms can be calculated more efficiently and accurately
1+
error: log base can be expressed more clearly
22
--> $DIR/floating_point_logbase.rs:7:13
33
|
44
LL | let _ = x.ln() / y.ln();
55
| ^^^^^^^^^^^^^^^ help: consider using: `x.log(y)`
66
|
77
= note: `-D clippy::suboptimal-flops` implied by `-D warnings`
88

9-
error: division of logarithms can be calculated more efficiently and accurately
9+
error: log base can be expressed more clearly
1010
--> $DIR/floating_point_logbase.rs:8:13
1111
|
1212
LL | let _ = x.log2() / y.log2();
1313
| ^^^^^^^^^^^^^^^^^^^ help: consider using: `x.log(y)`
1414

15-
error: division of logarithms can be calculated more efficiently and accurately
15+
error: log base can be expressed more clearly
1616
--> $DIR/floating_point_logbase.rs:9:13
1717
|
1818
LL | let _ = x.log10() / y.log10();
1919
| ^^^^^^^^^^^^^^^^^^^^^ help: consider using: `x.log(y)`
2020

21-
error: division of logarithms can be calculated more efficiently and accurately
21+
error: log base can be expressed more clearly
2222
--> $DIR/floating_point_logbase.rs:10:13
2323
|
2424
LL | let _ = x.log(5f32) / y.log(5f32);

0 commit comments

Comments
 (0)