2021-04-08 15:50:13 +00:00
|
|
|
error: all if blocks contain the same code at the end
|
2024-01-25 09:38:43 +00:00
|
|
|
--> $DIR/branches_sharing_code/shared_at_bottom.rs:35:5
|
2021-04-08 15:50:13 +00:00
|
|
|
|
|
|
|
|
LL | / let result = false;
|
2023-07-28 19:35:48 +00:00
|
|
|
LL | |
|
|
|
|
LL | |
|
2021-04-08 15:50:13 +00:00
|
|
|
LL | | println!("Block end!");
|
|
|
|
LL | | result
|
|
|
|
LL | | };
|
|
|
|
| |_____^
|
|
|
|
|
|
2022-09-22 16:04:22 +00:00
|
|
|
= note: the end suggestion probably needs some adjustments to use the expression result correctly
|
2021-04-08 15:50:13 +00:00
|
|
|
note: the lint level is defined here
|
2024-01-25 09:38:43 +00:00
|
|
|
--> $DIR/branches_sharing_code/shared_at_bottom.rs:1:36
|
2021-04-08 15:50:13 +00:00
|
|
|
|
|
|
|
|
LL | #![deny(clippy::if_same_then_else, clippy::branches_sharing_code)]
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
2022-06-16 15:39:06 +00:00
|
|
|
help: consider moving these statements after the if
|
2021-04-08 15:50:13 +00:00
|
|
|
|
|
2021-08-11 14:21:33 +00:00
|
|
|
LL ~ }
|
|
|
|
LL + let result = false;
|
2023-07-28 19:35:48 +00:00
|
|
|
LL +
|
|
|
|
LL +
|
2021-08-11 14:21:33 +00:00
|
|
|
LL + println!("Block end!");
|
|
|
|
LL ~ result;
|
2021-04-08 15:50:13 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
error: all if blocks contain the same code at the end
|
2024-01-25 09:38:43 +00:00
|
|
|
--> $DIR/branches_sharing_code/shared_at_bottom.rs:55:5
|
2021-04-08 15:50:13 +00:00
|
|
|
|
|
|
|
|
LL | / println!("Same end of block");
|
2023-07-28 19:35:48 +00:00
|
|
|
LL | |
|
2021-04-08 15:50:13 +00:00
|
|
|
LL | | }
|
|
|
|
| |_____^
|
|
|
|
|
|
2022-06-16 15:39:06 +00:00
|
|
|
help: consider moving these statements after the if
|
2021-04-08 15:50:13 +00:00
|
|
|
|
|
2021-08-11 14:21:33 +00:00
|
|
|
LL ~ }
|
|
|
|
LL + println!("Same end of block");
|
2021-04-08 15:50:13 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
error: all if blocks contain the same code at the end
|
2024-01-25 09:38:43 +00:00
|
|
|
--> $DIR/branches_sharing_code/shared_at_bottom.rs:73:5
|
2021-04-08 15:50:13 +00:00
|
|
|
|
|
|
|
|
LL | / println!(
|
2023-07-28 19:35:48 +00:00
|
|
|
LL | |
|
2021-04-08 15:50:13 +00:00
|
|
|
LL | | "I'm moveable because I know: `outer_scope_value`: '{}'",
|
|
|
|
LL | | outer_scope_value
|
|
|
|
LL | | );
|
|
|
|
LL | | }
|
|
|
|
| |_____^
|
|
|
|
|
|
2022-06-16 15:39:06 +00:00
|
|
|
help: consider moving these statements after the if
|
2021-04-08 15:50:13 +00:00
|
|
|
|
|
2021-08-11 14:21:33 +00:00
|
|
|
LL ~ }
|
|
|
|
LL + println!(
|
2023-07-28 19:35:48 +00:00
|
|
|
LL +
|
2021-08-11 14:21:33 +00:00
|
|
|
LL + "I'm moveable because I know: `outer_scope_value`: '{}'",
|
|
|
|
LL + outer_scope_value
|
|
|
|
LL + );
|
2021-04-08 15:50:13 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
error: all if blocks contain the same code at the end
|
2024-01-25 09:38:43 +00:00
|
|
|
--> $DIR/branches_sharing_code/shared_at_bottom.rs:86:9
|
2021-04-08 15:50:13 +00:00
|
|
|
|
|
|
|
|
LL | / println!("Hello World");
|
2023-07-28 19:35:48 +00:00
|
|
|
LL | |
|
2021-04-08 15:50:13 +00:00
|
|
|
LL | | }
|
|
|
|
| |_________^
|
|
|
|
|
|
2022-06-16 15:39:06 +00:00
|
|
|
help: consider moving these statements after the if
|
2021-04-08 15:50:13 +00:00
|
|
|
|
|
2021-08-11 14:21:33 +00:00
|
|
|
LL ~ }
|
|
|
|
LL + println!("Hello World");
|
2021-04-08 15:50:13 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
error: all if blocks contain the same code at the end
|
2024-01-25 09:38:43 +00:00
|
|
|
--> $DIR/branches_sharing_code/shared_at_bottom.rs:103:5
|
2021-04-08 15:50:13 +00:00
|
|
|
|
|
|
|
|
LL | / let later_used_value = "A string value";
|
2023-07-28 19:35:48 +00:00
|
|
|
LL | |
|
2021-04-08 15:50:13 +00:00
|
|
|
LL | | println!("{}", later_used_value);
|
|
|
|
LL | | // I'm expecting a note about this
|
|
|
|
LL | | }
|
|
|
|
| |_____^
|
|
|
|
|
|
2022-06-16 15:39:06 +00:00
|
|
|
= warning: some moved values might need to be renamed to avoid wrong references
|
|
|
|
help: consider moving these statements after the if
|
2021-04-08 15:50:13 +00:00
|
|
|
|
|
2021-08-11 14:21:33 +00:00
|
|
|
LL ~ }
|
|
|
|
LL + let later_used_value = "A string value";
|
2023-07-28 19:35:48 +00:00
|
|
|
LL +
|
2021-08-11 14:21:33 +00:00
|
|
|
LL + println!("{}", later_used_value);
|
2021-04-08 15:50:13 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
error: all if blocks contain the same code at the end
|
2024-01-25 09:38:43 +00:00
|
|
|
--> $DIR/branches_sharing_code/shared_at_bottom.rs:117:5
|
2021-04-08 15:50:13 +00:00
|
|
|
|
|
|
|
|
LL | / let simple_examples = "I now identify as a &str :)";
|
2023-07-28 19:35:48 +00:00
|
|
|
LL | |
|
2021-04-08 15:50:13 +00:00
|
|
|
LL | | println!("This is the new simple_example: {}", simple_examples);
|
|
|
|
LL | | }
|
|
|
|
| |_____^
|
|
|
|
|
|
2022-06-16 15:39:06 +00:00
|
|
|
= warning: some moved values might need to be renamed to avoid wrong references
|
|
|
|
help: consider moving these statements after the if
|
2021-04-08 15:50:13 +00:00
|
|
|
|
|
2021-08-11 14:21:33 +00:00
|
|
|
LL ~ }
|
|
|
|
LL + let simple_examples = "I now identify as a &str :)";
|
2023-07-28 19:35:48 +00:00
|
|
|
LL +
|
2021-08-11 14:21:33 +00:00
|
|
|
LL + println!("This is the new simple_example: {}", simple_examples);
|
2021-04-08 15:50:13 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
error: all if blocks contain the same code at the end
|
2024-01-25 09:38:43 +00:00
|
|
|
--> $DIR/branches_sharing_code/shared_at_bottom.rs:183:5
|
2021-04-08 15:50:13 +00:00
|
|
|
|
|
|
|
|
LL | / x << 2
|
2023-07-28 19:35:48 +00:00
|
|
|
LL | |
|
|
|
|
LL | |
|
2021-04-08 15:50:13 +00:00
|
|
|
LL | | };
|
|
|
|
| |_____^
|
|
|
|
|
|
2022-06-16 15:39:06 +00:00
|
|
|
= note: the end suggestion probably needs some adjustments to use the expression result correctly
|
|
|
|
help: consider moving these statements after the if
|
2021-04-08 15:50:13 +00:00
|
|
|
|
|
2021-08-11 14:21:33 +00:00
|
|
|
LL ~ }
|
|
|
|
LL ~ x << 2;
|
2021-04-08 15:50:13 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
error: all if blocks contain the same code at the end
|
2024-01-25 09:38:43 +00:00
|
|
|
--> $DIR/branches_sharing_code/shared_at_bottom.rs:192:5
|
2021-04-08 15:50:13 +00:00
|
|
|
|
|
|
|
|
LL | / x * 4
|
2023-07-28 19:35:48 +00:00
|
|
|
LL | |
|
|
|
|
LL | |
|
2021-04-08 15:50:13 +00:00
|
|
|
LL | | }
|
|
|
|
| |_____^
|
|
|
|
|
|
2022-06-16 15:39:06 +00:00
|
|
|
= note: the end suggestion probably needs some adjustments to use the expression result correctly
|
|
|
|
help: consider moving these statements after the if
|
2021-04-08 15:50:13 +00:00
|
|
|
|
|
2021-08-11 14:21:33 +00:00
|
|
|
LL ~ }
|
|
|
|
LL + x * 4
|
2021-04-08 15:50:13 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
error: all if blocks contain the same code at the end
|
2024-01-25 09:38:43 +00:00
|
|
|
--> $DIR/branches_sharing_code/shared_at_bottom.rs:206:44
|
2021-04-08 15:50:13 +00:00
|
|
|
|
|
|
|
|
LL | if x == 17 { b = 1; a = 0x99; } else { a = 0x99; }
|
|
|
|
| ^^^^^^^^^^^
|
|
|
|
|
|
2022-06-16 15:39:06 +00:00
|
|
|
help: consider moving these statements after the if
|
2021-04-08 15:50:13 +00:00
|
|
|
|
|
2021-08-11 14:21:33 +00:00
|
|
|
LL ~ if x == 17 { b = 1; a = 0x99; } else { }
|
|
|
|
LL + a = 0x99;
|
2021-04-08 15:50:13 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
error: aborting due to 9 previous errors
|
|
|
|
|