]> git.proxmox.com Git - rustc.git/blame - src/tools/clippy/tests/ui/branches_sharing_code/shared_at_top.stderr
New upstream version 1.63.0+dfsg1
[rustc.git] / src / tools / clippy / tests / ui / branches_sharing_code / shared_at_top.stderr
CommitLineData
cdc7bbd5
XL
1error: all if blocks contain the same code at the start
2 --> $DIR/shared_at_top.rs:10:5
3 |
4LL | / if true {
5LL | | println!("Hello World!");
6 | |_________________________________^
7 |
8note: the lint level is defined here
9 --> $DIR/shared_at_top.rs:2:36
10 |
11LL | #![deny(clippy::if_same_then_else, clippy::branches_sharing_code)]
12 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
923072b8 13help: consider moving these statements before the if
cdc7bbd5 14 |
94222f64
XL
15LL ~ println!("Hello World!");
16LL + if true {
cdc7bbd5
XL
17 |
18
19error: all if blocks contain the same code at the start
20 --> $DIR/shared_at_top.rs:19:5
21 |
22LL | / if x == 0 {
23LL | | let y = 9;
24LL | | println!("The value y was set to: `{}`", y);
25LL | | let _z = y;
26 | |___________________^
27 |
923072b8
FG
28 = warning: some moved values might need to be renamed to avoid wrong references
29help: consider moving these statements before the if
cdc7bbd5 30 |
94222f64
XL
31LL ~ let y = 9;
32LL + println!("The value y was set to: `{}`", y);
33LL + let _z = y;
34LL + if x == 0 {
cdc7bbd5
XL
35 |
36
37error: all if blocks contain the same code at the start
38 --> $DIR/shared_at_top.rs:40:5
39 |
40LL | / let _ = if x == 7 {
41LL | | let y = 16;
42 | |___________________^
43 |
923072b8 44help: consider moving these statements before the if
cdc7bbd5 45 |
94222f64
XL
46LL ~ let y = 16;
47LL + let _ = if x == 7 {
cdc7bbd5
XL
48 |
49
50error: all if blocks contain the same code at the start
51 --> $DIR/shared_at_top.rs:58:5
52 |
53LL | / if x == 10 {
54LL | | let used_value_name = "Different type";
55LL | | println!("Str: {}", used_value_name);
56 | |_____________________________________________^
57 |
923072b8
FG
58 = warning: some moved values might need to be renamed to avoid wrong references
59help: consider moving these statements before the if
cdc7bbd5 60 |
94222f64
XL
61LL ~ let used_value_name = "Different type";
62LL + println!("Str: {}", used_value_name);
63LL + if x == 10 {
cdc7bbd5
XL
64 |
65
66error: all if blocks contain the same code at the start
67 --> $DIR/shared_at_top.rs:72:5
68 |
69LL | / if x == 11 {
70LL | | let can_be_overridden = "Move me";
71LL | | println!("I'm also moveable");
72 | |______________________________________^
73 |
923072b8
FG
74 = warning: some moved values might need to be renamed to avoid wrong references
75help: consider moving these statements before the if
cdc7bbd5 76 |
94222f64
XL
77LL ~ let can_be_overridden = "Move me";
78LL + println!("I'm also moveable");
79LL + if x == 11 {
cdc7bbd5
XL
80 |
81
82error: all if blocks contain the same code at the start
83 --> $DIR/shared_at_top.rs:88:5
84 |
85LL | / if x == 2020 {
86LL | | println!("This should trigger the `SHARED_CODE_IN_IF_BLOCKS` lint.");
87LL | | println!("Because `IF_SAME_THEN_ELSE` is allowed here");
88 | |________________________________________________________________^
89 |
923072b8 90help: consider moving these statements before the if
cdc7bbd5 91 |
94222f64
XL
92LL ~ println!("This should trigger the `SHARED_CODE_IN_IF_BLOCKS` lint.");
93LL + println!("Because `IF_SAME_THEN_ELSE` is allowed here");
94LL + if x == 2020 {
cdc7bbd5
XL
95 |
96
97error: this `if` has identical blocks
98 --> $DIR/shared_at_top.rs:96:18
99 |
100LL | if x == 2019 {
101 | __________________^
102LL | | println!("This should trigger `IS_SAME_THAN_ELSE` as usual");
103LL | | } else {
104 | |_____^
105 |
106note: the lint level is defined here
107 --> $DIR/shared_at_top.rs:2:9
108 |
109LL | #![deny(clippy::if_same_then_else, clippy::branches_sharing_code)]
110 | ^^^^^^^^^^^^^^^^^^^^^^^^^
111note: same as this
112 --> $DIR/shared_at_top.rs:98:12
113 |
114LL | } else {
115 | ____________^
116LL | | println!("This should trigger `IS_SAME_THAN_ELSE` as usual");
117LL | | }
118 | |_____^
119
120error: aborting due to 7 previous errors
121