blob: 6784a7db950fabb16204999b6766bf5babe1e0c7 [file]
error: all if blocks contain the same code at the end
--> tests/ui/branches_sharing_code/shared_at_bottom.rs:34:5
|
LL | / let result = false;
LL | |
LL | |
LL | | println!("Block end!");
LL | | result
LL | | };
| |_____^
|
= note: the end suggestion probably needs some adjustments to use the expression result correctly
note: the lint level is defined here
--> tests/ui/branches_sharing_code/shared_at_bottom.rs:1:9
|
LL | #![deny(clippy::branches_sharing_code, clippy::if_same_then_else)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
help: consider moving these statements after the if
|
LL ~ }
LL + let result = false;
LL +
LL +
LL + println!("Block end!");
LL ~ result;
|
error: all if blocks contain the same code at the end
--> tests/ui/branches_sharing_code/shared_at_bottom.rs:54:5
|
LL | / println!("Same end of block");
LL | |
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
--> tests/ui/branches_sharing_code/shared_at_bottom.rs:72:5
|
LL | / println!(
LL | |
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 +
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
--> tests/ui/branches_sharing_code/shared_at_bottom.rs:85:9
|
LL | / println!("Hello World");
LL | |
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
--> tests/ui/branches_sharing_code/shared_at_bottom.rs:102:5
|
LL | / let later_used_value = "A string value";
LL | |
LL | |
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 +
LL +
LL + println!("{}", later_used_value);
|
error: all if blocks contain the same code at the end
--> tests/ui/branches_sharing_code/shared_at_bottom.rs:117:5
|
LL | / let simple_examples = "I now identify as a &str :)";
LL | |
LL | |
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 +
LL +
LL + println!("This is the new simple_example: {}", simple_examples);
|
error: all if blocks contain the same code at the end
--> tests/ui/branches_sharing_code/shared_at_bottom.rs:184:5
|
LL | / x << 2
LL | |
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
--> tests/ui/branches_sharing_code/shared_at_bottom.rs:192:5
|
LL | / x * 4
LL | |
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
--> tests/ui/branches_sharing_code/shared_at_bottom.rs:205: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: all if blocks contain the same code at the end
--> tests/ui/branches_sharing_code/shared_at_bottom.rs:273:9
|
LL | / let y = 1;
LL | |
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 y = 1;
|
error: all if blocks contain the same code at the end
--> tests/ui/branches_sharing_code/shared_at_bottom.rs:289:5
|
LL | / 0
LL | |
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 ~ 0;
|
error: all if blocks contain the same code at the end
--> tests/ui/branches_sharing_code/shared_at_bottom.rs:298:5
|
LL | / 1
LL | |
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 ~ 1;
|
error: all if blocks contain the same code at the start
--> tests/ui/branches_sharing_code/shared_at_bottom.rs:312:5
|
LL | / if false {
LL | |
LL | | type ISize = isize;
LL | | return ISize::MAX;
| |__________________________^
|
help: consider moving these statements before the if
|
LL ~ type ISize = isize;
LL + return ISize::MAX;
LL + if false {
|
error: all if blocks contain the same code at the start
--> tests/ui/branches_sharing_code/shared_at_bottom.rs:321:5
|
LL | / if false {
LL | |
LL | | fn foo() -> isize {
LL | | 4
LL | | }
LL | | return foo();
| |_____________________^
|
help: consider moving these statements before the if
|
LL ~ fn foo() -> isize {
LL + 4
LL + }
LL + return foo();
LL + if false {
|
error: all if blocks contain the same code at the start
--> tests/ui/branches_sharing_code/shared_at_bottom.rs:334:5
|
LL | / if false {
LL | |
LL | | use std::num::NonZeroIsize;
LL | | return NonZeroIsize::new(4).unwrap().get();
| |___________________________________________________^
|
help: consider moving these statements before the if
|
LL ~ use std::num::NonZeroIsize;
LL + return NonZeroIsize::new(4).unwrap().get();
LL + if false {
|
error: all if blocks contain the same code at the start
--> tests/ui/branches_sharing_code/shared_at_bottom.rs:343:5
|
LL | / if false {
LL | |
LL | | const B: isize = 5;
LL | | return B;
| |_________________^
|
help: consider moving these statements before the if
|
LL ~ const B: isize = 5;
LL + return B;
LL + if false {
|
error: aborting due to 16 previous errors