blob: 369d6f6673722d2c78a55d0271ca4b4a248a0af7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
|
error: this `if` has identical blocks
--> tests/ui/if_same_then_else2.rs:15:13
|
LL | if true {
| _____________^
LL | | for _ in &[42] {
LL | | let foo: &Option<_> = &Some::<u8>(42);
LL | | if foo.is_some() {
... |
LL | | } else {
| |_____^
|
note: same as this
--> tests/ui/if_same_then_else2.rs:24:12
|
LL | } else {
| ____________^
LL | | for _ in &[42] {
LL | | let bar: &Option<_> = &Some::<u8>(42);
LL | | if bar.is_some() {
... |
LL | | }
| |_____^
= note: `-D clippy::if-same-then-else` implied by `-D warnings`
= help: to override `-D warnings` add `#[allow(clippy::if_same_then_else)]`
error: this `if` has identical blocks
--> tests/ui/if_same_then_else2.rs:36:13
|
LL | if true {
| _____________^
LL | | if let Some(a) = Some(42) {}
LL | | } else {
| |_____^
|
note: same as this
--> tests/ui/if_same_then_else2.rs:38:12
|
LL | } else {
| ____________^
LL | | if let Some(a) = Some(42) {}
LL | | }
| |_____^
error: this `if` has identical blocks
--> tests/ui/if_same_then_else2.rs:43:13
|
LL | if true {
| _____________^
LL | | if let (1, .., 3) = (1, 2, 3) {}
LL | | } else {
| |_____^
|
note: same as this
--> tests/ui/if_same_then_else2.rs:45:12
|
LL | } else {
| ____________^
LL | | if let (1, .., 3) = (1, 2, 3) {}
LL | | }
| |_____^
error: this `if` has identical blocks
--> tests/ui/if_same_then_else2.rs:93:21
|
LL | let _ = if true { f32::NAN } else { f32::NAN };
| ^^^^^^^^^^^^
|
note: same as this
--> tests/ui/if_same_then_else2.rs:93:39
|
LL | let _ = if true { f32::NAN } else { f32::NAN };
| ^^^^^^^^^^^^
error: this `if` has identical blocks
--> tests/ui/if_same_then_else2.rs:96:13
|
LL | if true {
| _____________^
LL | | Ok("foo")?;
LL | | } else {
| |_____^
|
note: same as this
--> tests/ui/if_same_then_else2.rs:98:12
|
LL | } else {
| ____________^
LL | | Ok("foo")?;
LL | | }
| |_____^
error: this `if` has identical blocks
--> tests/ui/if_same_then_else2.rs:120:20
|
LL | } else if true {
| ____________________^
LL | | let foo = "";
LL | | return Ok(&foo[0..]);
LL | | } else {
| |_____^
|
note: same as this
--> tests/ui/if_same_then_else2.rs:123:12
|
LL | } else {
| ____________^
LL | | let foo = "";
LL | | return Ok(&foo[0..]);
LL | | }
| |_____^
error: aborting due to 6 previous errors
|