]> git.lizzy.rs Git - rust.git/blob - tests/ui/branches_sharing_code/shared_at_top_and_bottom.stderr
Rollup merge of #92849 - flip1995:clippyup, r=Manishearth
[rust.git] / tests / ui / branches_sharing_code / shared_at_top_and_bottom.stderr
1 error: all if blocks contain the same code at the start and the end. Here at the start
2   --> $DIR/shared_at_top_and_bottom.rs:16:5
3    |
4 LL | /     if x == 7 {
5 LL | |         let t = 7;
6 LL | |         let _overlap_start = t * 2;
7 LL | |         let _overlap_end = 2 * t;
8    | |_________________________________^
9    |
10 note: the lint level is defined here
11   --> $DIR/shared_at_top_and_bottom.rs:2:36
12    |
13 LL | #![deny(clippy::if_same_then_else, clippy::branches_sharing_code)]
14    |                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
15 note: and here at the end
16   --> $DIR/shared_at_top_and_bottom.rs:28:5
17    |
18 LL | /         let _u = 9;
19 LL | |     }
20    | |_____^
21 help: consider moving the start statements out like this
22    |
23 LL ~     let t = 7;
24 LL +     let _overlap_start = t * 2;
25 LL +     let _overlap_end = 2 * t;
26 LL +     if x == 7 {
27    |
28 help: and consider moving the end statements out like this
29    |
30 LL ~     }
31 LL +     let _u = 9;
32    |
33
34 error: all if blocks contain the same code at the start and the end. Here at the start
35   --> $DIR/shared_at_top_and_bottom.rs:32:5
36    |
37 LL | /     if x == 99 {
38 LL | |         let r = 7;
39 LL | |         let _overlap_start = r;
40 LL | |         let _overlap_middle = r * r;
41    | |____________________________________^
42    |
43 note: and here at the end
44   --> $DIR/shared_at_top_and_bottom.rs:43:5
45    |
46 LL | /         let _overlap_end = r * r * r;
47 LL | |         let z = "end";
48 LL | |     }
49    | |_____^
50    = warning: Some moved values might need to be renamed to avoid wrong references
51 help: consider moving the start statements out like this
52    |
53 LL ~     let r = 7;
54 LL +     let _overlap_start = r;
55 LL +     let _overlap_middle = r * r;
56 LL +     if x == 99 {
57    |
58 help: and consider moving the end statements out like this
59    |
60 LL ~     }
61 LL +     let _overlap_end = r * r * r;
62 LL +     let z = "end";
63    |
64
65 error: all if blocks contain the same code at the start and the end. Here at the start
66   --> $DIR/shared_at_top_and_bottom.rs:61:5
67    |
68 LL | /     if (x > 7 && y < 13) || (x + y) % 2 == 1 {
69 LL | |         let a = 0xcafe;
70 LL | |         let b = 0xffff00ff;
71 LL | |         let e_id = gen_id(a, b);
72    | |________________________________^
73    |
74 note: and here at the end
75   --> $DIR/shared_at_top_and_bottom.rs:81:5
76    |
77 LL | /         let pack = DataPack {
78 LL | |             id: e_id,
79 LL | |             name: "Player 1".to_string(),
80 LL | |             some_data: vec![0x12, 0x34, 0x56, 0x78, 0x90],
81 LL | |         };
82 LL | |         process_data(pack);
83 LL | |     }
84    | |_____^
85    = warning: Some moved values might need to be renamed to avoid wrong references
86 help: consider moving the start statements out like this
87    |
88 LL ~     let a = 0xcafe;
89 LL +     let b = 0xffff00ff;
90 LL +     let e_id = gen_id(a, b);
91 LL +     if (x > 7 && y < 13) || (x + y) % 2 == 1 {
92    |
93 help: and consider moving the end statements out like this
94    |
95 LL ~     }
96 LL +     let pack = DataPack {
97 LL +         id: e_id,
98 LL +         name: "Player 1".to_string(),
99 LL +         some_data: vec![0x12, 0x34, 0x56, 0x78, 0x90],
100 LL +     };
101  ...
102
103 error: all if blocks contain the same code at the start and the end. Here at the start
104   --> $DIR/shared_at_top_and_bottom.rs:94:5
105    |
106 LL | /     let _ = if x == 7 {
107 LL | |         let _ = 19;
108    | |___________________^
109    |
110 note: and here at the end
111   --> $DIR/shared_at_top_and_bottom.rs:103:5
112    |
113 LL | /         x << 2
114 LL | |     };
115    | |_____^
116    = note: The end suggestion probably needs some adjustments to use the expression result correctly
117 help: consider moving the start statements out like this
118    |
119 LL ~     let _ = 19;
120 LL +     let _ = if x == 7 {
121    |
122 help: and consider moving the end statements out like this
123    |
124 LL ~     }
125 LL ~     x << 2;
126    |
127
128 error: all if blocks contain the same code at the start and the end. Here at the start
129   --> $DIR/shared_at_top_and_bottom.rs:106:5
130    |
131 LL | /     if x == 9 {
132 LL | |         let _ = 17;
133    | |___________________^
134    |
135 note: and here at the end
136   --> $DIR/shared_at_top_and_bottom.rs:115:5
137    |
138 LL | /         x * 4
139 LL | |     }
140    | |_____^
141    = note: The end suggestion probably needs some adjustments to use the expression result correctly
142 help: consider moving the start statements out like this
143    |
144 LL ~     let _ = 17;
145 LL +     if x == 9 {
146    |
147 help: and consider moving the end statements out like this
148    |
149 LL ~     }
150 LL +     x * 4
151    |
152
153 error: aborting due to 5 previous errors
154