summaryrefslogtreecommitdiffstats
path: root/src/tools/clippy/tests/ui/branches_sharing_code/shared_at_bottom.stderr
blob: 5e1a68d216ea8bf22fb2ba9a17d0bf90bf1982f2 (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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
error: all if blocks contain the same code at the end
  --> $DIR/shared_at_bottom.rs:30:5
   |
LL | /         let result = false;
LL | |         println!("Block end!");
LL | |         result
LL | |     };
   | |_____^
   |
note: the lint level is defined here
  --> $DIR/shared_at_bottom.rs:2:36
   |
LL | #![deny(clippy::if_same_then_else, clippy::branches_sharing_code)]
   |                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   = note: the end suggestion probably needs some adjustments to use the expression result correctly
help: consider moving these statements after the if
   |
LL ~     }
LL +     let result = false;
LL +     println!("Block end!");
LL ~     result;
   |

error: all if blocks contain the same code at the end
  --> $DIR/shared_at_bottom.rs:48:5
   |
LL | /         println!("Same end of block");
LL | |     }
   | |_____^
   |
help: consider moving these statements after the if
   |
LL ~     }
LL +     println!("Same end of block");
   |

error: all if blocks contain the same code at the end
  --> $DIR/shared_at_bottom.rs:65:5
   |
LL | /         println!(
LL | |             "I'm moveable because I know: `outer_scope_value`: '{}'",
LL | |             outer_scope_value
LL | |         );
LL | |     }
   | |_____^
   |
help: consider moving these statements after the if
   |
LL ~     }
LL +     println!(
LL +         "I'm moveable because I know: `outer_scope_value`: '{}'",
LL +         outer_scope_value
LL +     );
   |

error: all if blocks contain the same code at the end
  --> $DIR/shared_at_bottom.rs:77:9
   |
LL | /             println!("Hello World");
LL | |         }
   | |_________^
   |
help: consider moving these statements after the if
   |
LL ~         }
LL +         println!("Hello World");
   |

error: all if blocks contain the same code at the end
  --> $DIR/shared_at_bottom.rs:93:5
   |
LL | /         let later_used_value = "A string value";
LL | |         println!("{}", later_used_value);
LL | |         // I'm expecting a note about this
LL | |     }
   | |_____^
   |
   = warning: some moved values might need to be renamed to avoid wrong references
help: consider moving these statements after the if
   |
LL ~     }
LL +     let later_used_value = "A string value";
LL +     println!("{}", later_used_value);
   |

error: all if blocks contain the same code at the end
  --> $DIR/shared_at_bottom.rs:106:5
   |
LL | /         let simple_examples = "I now identify as a &str :)";
LL | |         println!("This is the new simple_example: {}", simple_examples);
LL | |     }
   | |_____^
   |
   = warning: some moved values might need to be renamed to avoid wrong references
help: consider moving these statements after the if
   |
LL ~     }
LL +     let simple_examples = "I now identify as a &str :)";
LL +     println!("This is the new simple_example: {}", simple_examples);
   |

error: all if blocks contain the same code at the end
  --> $DIR/shared_at_bottom.rs:171:5
   |
LL | /         x << 2
LL | |     };
   | |_____^
   |
   = note: the end suggestion probably needs some adjustments to use the expression result correctly
help: consider moving these statements after the if
   |
LL ~     }
LL ~     x << 2;
   |

error: all if blocks contain the same code at the end
  --> $DIR/shared_at_bottom.rs:178:5
   |
LL | /         x * 4
LL | |     }
   | |_____^
   |
   = note: the end suggestion probably needs some adjustments to use the expression result correctly
help: consider moving these statements after the if
   |
LL ~     }
LL +     x * 4
   |

error: all if blocks contain the same code at the end
  --> $DIR/shared_at_bottom.rs:190:44
   |
LL |     if x == 17 { b = 1; a = 0x99; } else { a = 0x99; }
   |                                            ^^^^^^^^^^^
   |
help: consider moving these statements after the if
   |
LL ~     if x == 17 { b = 1; a = 0x99; } else { }
LL +     a = 0x99;
   |

error: aborting due to 9 previous errors