about summary refs log tree commit diff
path: root/tests/ui/branches_sharing_code/shared_at_bottom.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/branches_sharing_code/shared_at_bottom.rs')
-rw-r--r--tests/ui/branches_sharing_code/shared_at_bottom.rs14
1 files changed, 13 insertions, 1 deletions
diff --git a/tests/ui/branches_sharing_code/shared_at_bottom.rs b/tests/ui/branches_sharing_code/shared_at_bottom.rs
index 6a63008b5a7..d102efa7a58 100644
--- a/tests/ui/branches_sharing_code/shared_at_bottom.rs
+++ b/tests/ui/branches_sharing_code/shared_at_bottom.rs
@@ -1,7 +1,7 @@
 #![deny(clippy::if_same_then_else, clippy::branches_sharing_code)]
 #![allow(dead_code)]
 #![allow(clippy::equatable_if_let, clippy::uninlined_format_args)]
-
+//@no-rustfix
 // This tests the branches_sharing_code lint at the end of blocks
 
 fn simple_examples() {
@@ -29,6 +29,8 @@ fn simple_examples() {
 
         // The rest is self contained and moveable => Only lint the rest
         let result = false;
+        //~^ ERROR: all if blocks contain the same code at the end
+        //~| NOTE: the end suggestion probably needs some adjustments to use the expressio
         println!("Block end!");
         result
     };
@@ -47,6 +49,7 @@ fn simple_examples() {
     } else {
         println!("This is also eq with the else block");
         println!("Same end of block");
+        //~^ ERROR: all if blocks contain the same code at the end
     }
 
     // Use of outer scope value
@@ -64,6 +67,7 @@ fn simple_examples() {
         println!("I'm a local because I use the value `z`: `{}`", z);
 
         println!(
+            //~^ ERROR: all if blocks contain the same code at the end
             "I'm moveable because I know: `outer_scope_value`: '{}'",
             outer_scope_value
         );
@@ -76,6 +80,7 @@ fn simple_examples() {
             println!("Hello World");
         } else {
             println!("Hello World");
+            //~^ ERROR: all if blocks contain the same code at the end
         }
     }
 }
@@ -92,6 +97,7 @@ fn simple_but_suggestion_is_invalid() {
         println!("{}", later_used_value);
     } else {
         let later_used_value = "A string value";
+        //~^ ERROR: all if blocks contain the same code at the end
         println!("{}", later_used_value);
         // I'm expecting a note about this
     }
@@ -105,6 +111,7 @@ fn simple_but_suggestion_is_invalid() {
         println!("Separator print statement");
 
         let simple_examples = "I now identify as a &str :)";
+        //~^ ERROR: all if blocks contain the same code at the end
         println!("This is the new simple_example: {}", simple_examples);
     }
     simple_examples();
@@ -170,6 +177,8 @@ fn added_note_for_expression_use() -> u32 {
     } else {
         let _ = 6;
         x << 2
+        //~^ ERROR: all if blocks contain the same code at the end
+        //~| NOTE: the end suggestion probably needs some adjustments to use the expressio
     };
 
     if x == 9 {
@@ -177,6 +186,8 @@ fn added_note_for_expression_use() -> u32 {
     } else {
         let _ = 17;
         x * 4
+        //~^ ERROR: all if blocks contain the same code at the end
+        //~| NOTE: the end suggestion probably needs some adjustments to use the expressio
     }
 }
 
@@ -189,6 +200,7 @@ fn test_suggestion_with_weird_formatting() {
     // The error message still looks weird tbh but this is the best I can do
     // for weird formatting
     if x == 17 { b = 1; a = 0x99; } else { a = 0x99; }
+    //~^ ERROR: all if blocks contain the same code at the end
 }
 
 fn fp_test() {