]> git.lizzy.rs Git - rust.git/blob - tests/ui/if_same_then_else2.stderr
Improved shared_code_in_if_blocks message and added test stderrs
[rust.git] / tests / ui / if_same_then_else2.stderr
1 error: this `if` has identical blocks
2   --> $DIR/if_same_then_else2.rs:21:12
3    |
4 LL |       } else {
5    |  ____________^
6 LL | |         //~ ERROR same body as `if` block
7 LL | |         for _ in &[42] {
8 LL | |             let bar: &Option<_> = &Some::<u8>(42);
9 ...  |
10 LL | |         }
11 LL | |     }
12    | |_____^
13    |
14    = note: `-D clippy::if-same-then-else` implied by `-D warnings`
15 note: same as this
16   --> $DIR/if_same_then_else2.rs:12:13
17    |
18 LL |       if true {
19    |  _____________^
20 LL | |         for _ in &[42] {
21 LL | |             let foo: &Option<_> = &Some::<u8>(42);
22 LL | |             if foo.is_some() {
23 ...  |
24 LL | |         }
25 LL | |     } else {
26    | |_____^
27    |
28    = note: `-D clippy::if-same-then-else` implied by `-D warnings`
29 note: same as this
30   --> $DIR/if_same_then_else2.rs:22:12
31    |
32 LL |       } else {
33    |  ____________^
34 LL | |         //~ ERROR same body as `if` block
35 LL | |         for _ in &[42] {
36 LL | |             let foo: &Option<_> = &Some::<u8>(42);
37 ...  |
38 LL | |         }
39 LL | |     }
40    | |_____^
41
42 error: this `if` has identical blocks
43   --> $DIR/if_same_then_else2.rs:34:13
44    |
45 LL |       if true {
46    |  _____________^
47 LL | |         if let Some(a) = Some(42) {}
48 LL | |     } else {
49    | |_____^
50    |
51 note: same as this
52   --> $DIR/if_same_then_else2.rs:36:12
53    |
54 LL |       } else {
55    |  ____________^
56 LL | |         //~ ERROR same body as `if` block
57 LL | |         if let Some(a) = Some(42) {}
58 LL | |     }
59    | |_____^
60
61 error: this `if` has identical blocks
62   --> $DIR/if_same_then_else2.rs:41:13
63    |
64 LL |       if true {
65    |  _____________^
66 LL | |         if let (1, .., 3) = (1, 2, 3) {}
67 LL | |     } else {
68    | |_____^
69    |
70 note: same as this
71   --> $DIR/if_same_then_else2.rs:43:12
72    |
73 LL |       } else {
74    |  ____________^
75 LL | |         //~ ERROR same body as `if` block
76 LL | |         if let (1, .., 3) = (1, 2, 3) {}
77 LL | |     }
78    | |_____^
79
80 error: this `if` has identical blocks
81   --> $DIR/if_same_then_else2.rs:91:21
82    |
83 LL |       let _ = if true {
84    |  _____________________^
85 LL | |         f32::NAN
86 LL | |     } else {
87    | |_____^
88    |
89 note: same as this
90   --> $DIR/if_same_then_else2.rs:93:12
91    |
92 LL |       } else {
93    |  ____________^
94 LL | |         //~ ERROR same body as `if` block
95 LL | |         f32::NAN
96 LL | |     };
97    | |_____^
98
99 error: this `if` has identical blocks
100   --> $DIR/if_same_then_else2.rs:98:13
101    |
102 LL |       if true {
103    |  _____________^
104 LL | |         Ok("foo")?;
105 LL | |     } else {
106    | |_____^
107    |
108 note: same as this
109   --> $DIR/if_same_then_else2.rs:100:12
110    |
111 LL |       } else {
112    |  ____________^
113 LL | |         //~ ERROR same body as `if` block
114 LL | |         Ok("foo")?;
115 LL | |     }
116    | |_____^
117
118 error: this `if` has identical blocks
119   --> $DIR/if_same_then_else2.rs:122:20
120    |
121 LL |       } else if true {
122    |  ____________________^
123 LL | |         let foo = "";
124 LL | |         return Ok(&foo[0..]);
125 LL | |     } else {
126    | |_____^
127    |
128 note: same as this
129   --> $DIR/if_same_then_else2.rs:125:12
130    |
131 LL |       } else {
132    |  ____________^
133 LL | |         let foo = "";
134 LL | |         return Ok(&foo[0..]);
135 LL | |     }
136    | |_____^
137
138 error: aborting due to 6 previous errors
139