blob: ce7fff0122f1ff58d14f594a34adeb435dcd8ba9 (
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
|
error: this `if` has identical blocks
--> $DIR/valid_if_blocks.rs:105:14
|
LL | if false {
| ______________^
LL | | } else {
| |_____^
|
note: same as this
--> $DIR/valid_if_blocks.rs:106:12
|
LL | } else {
| ____________^
LL | | }
| |_____^
note: the lint level is defined here
--> $DIR/valid_if_blocks.rs:1:40
|
LL | #![deny(clippy::branches_sharing_code, clippy::if_same_then_else)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^
error: this `if` has identical blocks
--> $DIR/valid_if_blocks.rs:116:15
|
LL | if x == 0 {
| _______________^
LL | | let u = 19;
LL | | println!("How are u today?");
LL | | let _ = "This is a string";
LL | | } else {
| |_____^
|
note: same as this
--> $DIR/valid_if_blocks.rs:120:12
|
LL | } else {
| ____________^
LL | | let u = 19;
LL | | println!("How are u today?");
LL | | let _ = "This is a string";
LL | | }
| |_____^
error: this `if` has identical blocks
--> $DIR/valid_if_blocks.rs:127:23
|
LL | let _ = if x == 6 { 7 } else { 7 };
| ^^^^^
|
note: same as this
--> $DIR/valid_if_blocks.rs:127:34
|
LL | let _ = if x == 6 { 7 } else { 7 };
| ^^^^^
error: this `if` has identical blocks
--> $DIR/valid_if_blocks.rs:133:23
|
LL | } else if x == 68 {
| _______________________^
LL | | println!("I'm a doppelgänger");
LL | | // Don't listen to my clone below
LL | |
LL | | if y == 90 { "=^.^=" } else { ":D" }
LL | | } else {
| |_____^
|
note: same as this
--> $DIR/valid_if_blocks.rs:138:12
|
LL | } else {
| ____________^
LL | | // Don't listen to my clone above
LL | | println!("I'm a doppelgänger");
LL | |
LL | | if y == 90 { "=^.^=" } else { ":D" }
LL | | };
| |_____^
error: this `if` has identical blocks
--> $DIR/valid_if_blocks.rs:147:23
|
LL | } else if x == 68 {
| _______________________^
LL | | println!("I'm a doppelgänger");
LL | | // Don't listen to my clone below
LL | | } else {
| |_____^
|
note: same as this
--> $DIR/valid_if_blocks.rs:150:12
|
LL | } else {
| ____________^
LL | | // Don't listen to my clone above
LL | | println!("I'm a doppelgänger");
LL | | }
| |_____^
error: aborting due to 5 previous errors
|