1
1
error: manual implementation of `midpoint` which can overflow
2
- --> tests/ui/manual_midpoint.rs:30 :13
2
+ --> tests/ui/manual_midpoint.rs:31 :13
3
3
|
4
4
LL | let _ = (a + 5) / 2;
5
5
| ^^^^^^^^^^^ help: use `u32::midpoint` instead: `u32::midpoint(a, 5)`
@@ -8,52 +8,58 @@ LL | let _ = (a + 5) / 2;
8
8
= help: to override `-D warnings` add `#[allow(clippy::manual_midpoint)]`
9
9
10
10
error: manual implementation of `midpoint` which can overflow
11
- --> tests/ui/manual_midpoint.rs:33 :13
11
+ --> tests/ui/manual_midpoint.rs:34 :13
12
12
|
13
13
LL | let _ = (f + 5.0) / 2.0;
14
14
| ^^^^^^^^^^^^^^^ help: use `f32::midpoint` instead: `f32::midpoint(f, 5.0)`
15
15
16
16
error: manual implementation of `midpoint` which can overflow
17
- --> tests/ui/manual_midpoint.rs:35 :22
17
+ --> tests/ui/manual_midpoint.rs:36 :22
18
18
|
19
19
LL | let _: u32 = 5 + (8 + 8) / 2 + 2;
20
20
| ^^^^^^^^^^^ help: use `u32::midpoint` instead: `u32::midpoint(8, 8)`
21
21
22
22
error: manual implementation of `midpoint` which can overflow
23
- --> tests/ui/manual_midpoint.rs:36 :26
23
+ --> tests/ui/manual_midpoint.rs:37 :26
24
24
|
25
25
LL | let _: u32 = const { (8 + 8) / 2 };
26
26
| ^^^^^^^^^^^ help: use `u32::midpoint` instead: `u32::midpoint(8, 8)`
27
27
28
28
error: manual implementation of `midpoint` which can overflow
29
- --> tests/ui/manual_midpoint.rs:37 :26
29
+ --> tests/ui/manual_midpoint.rs:38 :26
30
30
|
31
31
LL | let _: f64 = const { (8.0f64 + 8.) / 2. };
32
32
| ^^^^^^^^^^^^^^^^^^ help: use `f64::midpoint` instead: `f64::midpoint(8.0f64, 8.)`
33
33
34
34
error: manual implementation of `midpoint` which can overflow
35
- --> tests/ui/manual_midpoint.rs:38 :18
35
+ --> tests/ui/manual_midpoint.rs:39 :18
36
36
|
37
37
LL | let _: u32 = (u32::default() + u32::default()) / 2;
38
38
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `u32::midpoint` instead: `u32::midpoint(u32::default(), u32::default())`
39
39
40
40
error: manual implementation of `midpoint` which can overflow
41
- --> tests/ui/manual_midpoint.rs:39 :18
41
+ --> tests/ui/manual_midpoint.rs:40 :18
42
42
|
43
43
LL | let _: u32 = (two!() + two!()) / 2;
44
44
| ^^^^^^^^^^^^^^^^^^^^^ help: use `u32::midpoint` instead: `u32::midpoint(two!(), two!())`
45
45
46
46
error: manual implementation of `midpoint` which can overflow
47
- --> tests/ui/manual_midpoint.rs:61 :13
47
+ --> tests/ui/manual_midpoint.rs:62 :13
48
48
|
49
49
LL | let _ = (f + 1.0) / 2.0;
50
50
| ^^^^^^^^^^^^^^^ help: use `f32::midpoint` instead: `f32::midpoint(f, 1.0)`
51
51
52
52
error: manual implementation of `midpoint` which can overflow
53
- --> tests/ui/manual_midpoint.rs:62 :13
53
+ --> tests/ui/manual_midpoint.rs:63 :13
54
54
|
55
55
LL | let _ = (1.0 + f) / 2.0;
56
56
| ^^^^^^^^^^^^^^^ help: use `f32::midpoint` instead: `f32::midpoint(1.0, f)`
57
57
58
- error: aborting due to 9 previous errors
58
+ error: manual implementation of `midpoint` which can overflow
59
+ --> tests/ui/manual_midpoint.rs:74:13
60
+ |
61
+ LL | let _ = (i + 10) / 2;
62
+ | ^^^^^^^^^^^^ help: use `i32::midpoint` instead: `i32::midpoint(i, 10)`
63
+
64
+ error: aborting due to 10 previous errors
59
65
0 commit comments