about summary refs log tree commit diff
path: root/tests/ui/branches_sharing_code/shared_at_bottom.stderr
diff options
context:
space:
mode:
authorxFrednet <xFrednet@gmail.com>2021-04-01 18:30:47 +0200
committerxFrednet <xFrednet@gmail.com>2021-04-05 13:35:51 +0200
commita6f54f5dfdfdf0017ffecfbcd6f43352b8b71ca1 (patch)
tree2ddb446dad2a9f74f64844a0de370fbe1f7563be /tests/ui/branches_sharing_code/shared_at_bottom.stderr
parent7c9e192e055f8b8a8a5f8b177c415440bc2333ce (diff)
downloadrust-a6f54f5dfdfdf0017ffecfbcd6f43352b8b71ca1.tar.gz
rust-a6f54f5dfdfdf0017ffecfbcd6f43352b8b71ca1.zip
Renaming the lint to branches_sharing_code and fixing typos
Diffstat (limited to 'tests/ui/branches_sharing_code/shared_at_bottom.stderr')
-rw-r--r--tests/ui/branches_sharing_code/shared_at_bottom.stderr143
1 files changed, 143 insertions, 0 deletions
diff --git a/tests/ui/branches_sharing_code/shared_at_bottom.stderr b/tests/ui/branches_sharing_code/shared_at_bottom.stderr
new file mode 100644
index 00000000000..271fcd8b6c1
--- /dev/null
+++ b/tests/ui/branches_sharing_code/shared_at_bottom.stderr
@@ -0,0 +1,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 the end statements out like this
+   |
+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 the end statements out like this
+   |
+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 the end statements out like this
+   |
+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 the end statements out like this
+   |
+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 the end statements out like this
+   |
+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 the end statements out like this
+   |
+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 the end statements out like this
+   |
+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 the end statements out like this
+   |
+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 the end statements out like this
+   |
+LL |     if x == 17 { b = 1; a = 0x99; } else { }
+LL |     a = 0x99;
+   |
+
+error: aborting due to 9 previous errors
+