Skip to content

Commit f204398

Browse files
committed
ignore the lint on some test files
Signed-off-by: TennyZhuang <[email protected]>
1 parent 081f739 commit f204398

20 files changed

+93
-81
lines changed

tests/ui/floating_point_exp.fixed

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// run-rustfix
22
#![warn(clippy::imprecise_flops)]
3+
#![allow(clippy::unnecessary_cast)]
34

45
fn main() {
56
let x = 2f32;

tests/ui/floating_point_exp.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// run-rustfix
22
#![warn(clippy::imprecise_flops)]
3+
#![allow(clippy::unnecessary_cast)]
34

45
fn main() {
56
let x = 2f32;

tests/ui/floating_point_exp.stderr

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,31 @@
11
error: (e.pow(x) - 1) can be computed more accurately
2-
--> $DIR/floating_point_exp.rs:6:13
2+
--> $DIR/floating_point_exp.rs:7:13
33
|
44
LL | let _ = x.exp() - 1.0;
55
| ^^^^^^^^^^^^^ help: consider using: `x.exp_m1()`
66
|
77
= note: `-D clippy::imprecise-flops` implied by `-D warnings`
88

99
error: (e.pow(x) - 1) can be computed more accurately
10-
--> $DIR/floating_point_exp.rs:7:13
10+
--> $DIR/floating_point_exp.rs:8:13
1111
|
1212
LL | let _ = x.exp() - 1.0 + 2.0;
1313
| ^^^^^^^^^^^^^ help: consider using: `x.exp_m1()`
1414

1515
error: (e.pow(x) - 1) can be computed more accurately
16-
--> $DIR/floating_point_exp.rs:8:13
16+
--> $DIR/floating_point_exp.rs:9:13
1717
|
1818
LL | let _ = (x as f32).exp() - 1.0 + 2.0;
1919
| ^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `(x as f32).exp_m1()`
2020

2121
error: (e.pow(x) - 1) can be computed more accurately
22-
--> $DIR/floating_point_exp.rs:14:13
22+
--> $DIR/floating_point_exp.rs:15:13
2323
|
2424
LL | let _ = x.exp() - 1.0;
2525
| ^^^^^^^^^^^^^ help: consider using: `x.exp_m1()`
2626

2727
error: (e.pow(x) - 1) can be computed more accurately
28-
--> $DIR/floating_point_exp.rs:15:13
28+
--> $DIR/floating_point_exp.rs:16:13
2929
|
3030
LL | let _ = x.exp() - 1.0 + 2.0;
3131
| ^^^^^^^^^^^^^ help: consider using: `x.exp_m1()`

tests/ui/floating_point_log.fixed

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// run-rustfix
2-
#![allow(dead_code, clippy::double_parens)]
2+
#![allow(dead_code, clippy::double_parens, clippy::unnecessary_cast)]
33
#![warn(clippy::suboptimal_flops, clippy::imprecise_flops)]
44

55
const TWO: f32 = 2.0;

tests/ui/floating_point_log.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// run-rustfix
2-
#![allow(dead_code, clippy::double_parens)]
2+
#![allow(dead_code, clippy::double_parens, clippy::unnecessary_cast)]
33
#![warn(clippy::suboptimal_flops, clippy::imprecise_flops)]
44

55
const TWO: f32 = 2.0;

tests/ui/floating_point_logbase.fixed

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// run-rustfix
22
#![warn(clippy::suboptimal_flops)]
3+
#![allow(clippy::unnecessary_cast)]
34

45
fn main() {
56
let x = 3f32;

tests/ui/floating_point_logbase.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// run-rustfix
22
#![warn(clippy::suboptimal_flops)]
3+
#![allow(clippy::unnecessary_cast)]
34

45
fn main() {
56
let x = 3f32;

tests/ui/floating_point_logbase.stderr

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,31 @@
11
error: log base can be expressed more clearly
2-
--> $DIR/floating_point_logbase.rs:7:13
2+
--> $DIR/floating_point_logbase.rs:8: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

99
error: log base can be expressed more clearly
10-
--> $DIR/floating_point_logbase.rs:8:13
10+
--> $DIR/floating_point_logbase.rs:9:13
1111
|
1212
LL | let _ = (x as f32).ln() / y.ln();
1313
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `(x as f32).log(y)`
1414

1515
error: log base can be expressed more clearly
16-
--> $DIR/floating_point_logbase.rs:9:13
16+
--> $DIR/floating_point_logbase.rs:10:13
1717
|
1818
LL | let _ = x.log2() / y.log2();
1919
| ^^^^^^^^^^^^^^^^^^^ help: consider using: `x.log(y)`
2020

2121
error: log base can be expressed more clearly
22-
--> $DIR/floating_point_logbase.rs:10:13
22+
--> $DIR/floating_point_logbase.rs:11:13
2323
|
2424
LL | let _ = x.log10() / y.log10();
2525
| ^^^^^^^^^^^^^^^^^^^^^ help: consider using: `x.log(y)`
2626

2727
error: log base can be expressed more clearly
28-
--> $DIR/floating_point_logbase.rs:11:13
28+
--> $DIR/floating_point_logbase.rs:12:13
2929
|
3030
LL | let _ = x.log(5f32) / y.log(5f32);
3131
| ^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `x.log(y)`

tests/ui/floating_point_powf.fixed

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// run-rustfix
22
#![warn(clippy::suboptimal_flops, clippy::imprecise_flops)]
3+
#![allow(clippy::unnecessary_cast)]
34

45
fn main() {
56
let x = 3f32;

tests/ui/floating_point_powf.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// run-rustfix
22
#![warn(clippy::suboptimal_flops, clippy::imprecise_flops)]
3+
#![allow(clippy::unnecessary_cast)]
34

45
fn main() {
56
let x = 3f32;

tests/ui/floating_point_powf.stderr

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,189 +1,189 @@
11
error: exponent for bases 2 and e can be computed more accurately
2-
--> $DIR/floating_point_powf.rs:6:13
2+
--> $DIR/floating_point_powf.rs:7:13
33
|
44
LL | let _ = 2f32.powf(x);
55
| ^^^^^^^^^^^^ help: consider using: `x.exp2()`
66
|
77
= note: `-D clippy::suboptimal-flops` implied by `-D warnings`
88

99
error: exponent for bases 2 and e can be computed more accurately
10-
--> $DIR/floating_point_powf.rs:7:13
10+
--> $DIR/floating_point_powf.rs:8:13
1111
|
1212
LL | let _ = 2f32.powf(3.1);
1313
| ^^^^^^^^^^^^^^ help: consider using: `3.1f32.exp2()`
1414

1515
error: exponent for bases 2 and e can be computed more accurately
16-
--> $DIR/floating_point_powf.rs:8:13
16+
--> $DIR/floating_point_powf.rs:9:13
1717
|
1818
LL | let _ = 2f32.powf(-3.1);
1919
| ^^^^^^^^^^^^^^^ help: consider using: `(-3.1f32).exp2()`
2020

2121
error: exponent for bases 2 and e can be computed more accurately
22-
--> $DIR/floating_point_powf.rs:9:13
22+
--> $DIR/floating_point_powf.rs:10:13
2323
|
2424
LL | let _ = std::f32::consts::E.powf(x);
2525
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `x.exp()`
2626

2727
error: exponent for bases 2 and e can be computed more accurately
28-
--> $DIR/floating_point_powf.rs:10:13
28+
--> $DIR/floating_point_powf.rs:11:13
2929
|
3030
LL | let _ = std::f32::consts::E.powf(3.1);
3131
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `3.1f32.exp()`
3232

3333
error: exponent for bases 2 and e can be computed more accurately
34-
--> $DIR/floating_point_powf.rs:11:13
34+
--> $DIR/floating_point_powf.rs:12:13
3535
|
3636
LL | let _ = std::f32::consts::E.powf(-3.1);
3737
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `(-3.1f32).exp()`
3838

3939
error: square-root of a number can be computed more efficiently and accurately
40-
--> $DIR/floating_point_powf.rs:12:13
40+
--> $DIR/floating_point_powf.rs:13:13
4141
|
4242
LL | let _ = x.powf(1.0 / 2.0);
4343
| ^^^^^^^^^^^^^^^^^ help: consider using: `x.sqrt()`
4444

4545
error: cube-root of a number can be computed more accurately
46-
--> $DIR/floating_point_powf.rs:13:13
46+
--> $DIR/floating_point_powf.rs:14:13
4747
|
4848
LL | let _ = x.powf(1.0 / 3.0);
4949
| ^^^^^^^^^^^^^^^^^ help: consider using: `x.cbrt()`
5050
|
5151
= note: `-D clippy::imprecise-flops` implied by `-D warnings`
5252

5353
error: cube-root of a number can be computed more accurately
54-
--> $DIR/floating_point_powf.rs:14:13
54+
--> $DIR/floating_point_powf.rs:15:13
5555
|
5656
LL | let _ = (x as f32).powf(1.0 / 3.0);
5757
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `(x as f32).cbrt()`
5858

5959
error: exponentiation with integer powers can be computed more efficiently
60-
--> $DIR/floating_point_powf.rs:15:13
60+
--> $DIR/floating_point_powf.rs:16:13
6161
|
6262
LL | let _ = x.powf(3.0);
6363
| ^^^^^^^^^^^ help: consider using: `x.powi(3)`
6464

6565
error: exponentiation with integer powers can be computed more efficiently
66-
--> $DIR/floating_point_powf.rs:16:13
66+
--> $DIR/floating_point_powf.rs:17:13
6767
|
6868
LL | let _ = x.powf(-2.0);
6969
| ^^^^^^^^^^^^ help: consider using: `x.powi(-2)`
7070

7171
error: exponentiation with integer powers can be computed more efficiently
72-
--> $DIR/floating_point_powf.rs:17:13
72+
--> $DIR/floating_point_powf.rs:18:13
7373
|
7474
LL | let _ = x.powf(16_777_215.0);
7575
| ^^^^^^^^^^^^^^^^^^^^ help: consider using: `x.powi(16_777_215)`
7676

7777
error: exponentiation with integer powers can be computed more efficiently
78-
--> $DIR/floating_point_powf.rs:18:13
78+
--> $DIR/floating_point_powf.rs:19:13
7979
|
8080
LL | let _ = x.powf(-16_777_215.0);
8181
| ^^^^^^^^^^^^^^^^^^^^^ help: consider using: `x.powi(-16_777_215)`
8282

8383
error: exponentiation with integer powers can be computed more efficiently
84-
--> $DIR/floating_point_powf.rs:19:13
84+
--> $DIR/floating_point_powf.rs:20:13
8585
|
8686
LL | let _ = (x as f32).powf(-16_777_215.0);
8787
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `(x as f32).powi(-16_777_215)`
8888

8989
error: exponentiation with integer powers can be computed more efficiently
90-
--> $DIR/floating_point_powf.rs:20:13
90+
--> $DIR/floating_point_powf.rs:21:13
9191
|
9292
LL | let _ = (x as f32).powf(3.0);
9393
| ^^^^^^^^^^^^^^^^^^^^ help: consider using: `(x as f32).powi(3)`
9494

9595
error: cube-root of a number can be computed more accurately
96-
--> $DIR/floating_point_powf.rs:21:13
96+
--> $DIR/floating_point_powf.rs:22:13
9797
|
9898
LL | let _ = (1.5_f32 + 1.0).powf(1.0 / 3.0);
9999
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `(1.5_f32 + 1.0).cbrt()`
100100

101101
error: cube-root of a number can be computed more accurately
102-
--> $DIR/floating_point_powf.rs:22:13
102+
--> $DIR/floating_point_powf.rs:23:13
103103
|
104104
LL | let _ = 1.5_f64.powf(1.0 / 3.0);
105105
| ^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `1.5_f64.cbrt()`
106106

107107
error: square-root of a number can be computed more efficiently and accurately
108-
--> $DIR/floating_point_powf.rs:23:13
108+
--> $DIR/floating_point_powf.rs:24:13
109109
|
110110
LL | let _ = 1.5_f64.powf(1.0 / 2.0);
111111
| ^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `1.5_f64.sqrt()`
112112

113113
error: exponentiation with integer powers can be computed more efficiently
114-
--> $DIR/floating_point_powf.rs:24:13
114+
--> $DIR/floating_point_powf.rs:25:13
115115
|
116116
LL | let _ = 1.5_f64.powf(3.0);
117117
| ^^^^^^^^^^^^^^^^^ help: consider using: `1.5_f64.powi(3)`
118118

119119
error: exponent for bases 2 and e can be computed more accurately
120-
--> $DIR/floating_point_powf.rs:33:13
120+
--> $DIR/floating_point_powf.rs:34:13
121121
|
122122
LL | let _ = 2f64.powf(x);
123123
| ^^^^^^^^^^^^ help: consider using: `x.exp2()`
124124

125125
error: exponent for bases 2 and e can be computed more accurately
126-
--> $DIR/floating_point_powf.rs:34:13
126+
--> $DIR/floating_point_powf.rs:35:13
127127
|
128128
LL | let _ = 2f64.powf(3.1);
129129
| ^^^^^^^^^^^^^^ help: consider using: `3.1f64.exp2()`
130130

131131
error: exponent for bases 2 and e can be computed more accurately
132-
--> $DIR/floating_point_powf.rs:35:13
132+
--> $DIR/floating_point_powf.rs:36:13
133133
|
134134
LL | let _ = 2f64.powf(-3.1);
135135
| ^^^^^^^^^^^^^^^ help: consider using: `(-3.1f64).exp2()`
136136

137137
error: exponent for bases 2 and e can be computed more accurately
138-
--> $DIR/floating_point_powf.rs:36:13
138+
--> $DIR/floating_point_powf.rs:37:13
139139
|
140140
LL | let _ = std::f64::consts::E.powf(x);
141141
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `x.exp()`
142142

143143
error: exponent for bases 2 and e can be computed more accurately
144-
--> $DIR/floating_point_powf.rs:37:13
144+
--> $DIR/floating_point_powf.rs:38:13
145145
|
146146
LL | let _ = std::f64::consts::E.powf(3.1);
147147
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `3.1f64.exp()`
148148

149149
error: exponent for bases 2 and e can be computed more accurately
150-
--> $DIR/floating_point_powf.rs:38:13
150+
--> $DIR/floating_point_powf.rs:39:13
151151
|
152152
LL | let _ = std::f64::consts::E.powf(-3.1);
153153
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `(-3.1f64).exp()`
154154

155155
error: square-root of a number can be computed more efficiently and accurately
156-
--> $DIR/floating_point_powf.rs:39:13
156+
--> $DIR/floating_point_powf.rs:40:13
157157
|
158158
LL | let _ = x.powf(1.0 / 2.0);
159159
| ^^^^^^^^^^^^^^^^^ help: consider using: `x.sqrt()`
160160

161161
error: cube-root of a number can be computed more accurately
162-
--> $DIR/floating_point_powf.rs:40:13
162+
--> $DIR/floating_point_powf.rs:41:13
163163
|
164164
LL | let _ = x.powf(1.0 / 3.0);
165165
| ^^^^^^^^^^^^^^^^^ help: consider using: `x.cbrt()`
166166

167167
error: exponentiation with integer powers can be computed more efficiently
168-
--> $DIR/floating_point_powf.rs:41:13
168+
--> $DIR/floating_point_powf.rs:42:13
169169
|
170170
LL | let _ = x.powf(3.0);
171171
| ^^^^^^^^^^^ help: consider using: `x.powi(3)`
172172

173173
error: exponentiation with integer powers can be computed more efficiently
174-
--> $DIR/floating_point_powf.rs:42:13
174+
--> $DIR/floating_point_powf.rs:43:13
175175
|
176176
LL | let _ = x.powf(-2.0);
177177
| ^^^^^^^^^^^^ help: consider using: `x.powi(-2)`
178178

179179
error: exponentiation with integer powers can be computed more efficiently
180-
--> $DIR/floating_point_powf.rs:43:13
180+
--> $DIR/floating_point_powf.rs:44:13
181181
|
182182
LL | let _ = x.powf(-2_147_483_648.0);
183183
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `x.powi(-2_147_483_648)`
184184

185185
error: exponentiation with integer powers can be computed more efficiently
186-
--> $DIR/floating_point_powf.rs:44:13
186+
--> $DIR/floating_point_powf.rs:45:13
187187
|
188188
LL | let _ = x.powf(2_147_483_647.0);
189189
| ^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `x.powi(2_147_483_647)`

tests/ui/floating_point_powi.fixed

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// run-rustfix
22
#![warn(clippy::suboptimal_flops)]
3+
#![allow(clippy::unnecessary_cast)]
34

45
fn main() {
56
let one = 1;

tests/ui/floating_point_powi.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// run-rustfix
22
#![warn(clippy::suboptimal_flops)]
3+
#![allow(clippy::unnecessary_cast)]
34

45
fn main() {
56
let one = 1;

0 commit comments

Comments
 (0)