]> git.lizzy.rs Git - rust.git/commitdiff
Add test case for blocks with semicolon inside and outside a block
authorLukas Wirth <lukastw97@gmail.com>
Mon, 5 Dec 2022 10:02:10 +0000 (11:02 +0100)
committerLukas Wirth <lukastw97@gmail.com>
Mon, 5 Dec 2022 10:02:10 +0000 (11:02 +0100)
clippy_lints/src/semicolon_block.rs
tests/ui/semicolon_inside_block.fixed
tests/ui/semicolon_inside_block.rs
tests/ui/semicolon_outside_block.fixed
tests/ui/semicolon_outside_block.rs

index d3cab68137c492253f72a5ba41d00abddf96a07e..8f1d1490e1f085689ffb41be7407acbcd01e2bda 100644 (file)
@@ -8,11 +8,13 @@
 declare_clippy_lint! {
     /// ### What it does
     ///
-    /// Suggests moving the semicolon from a block inside of the block to its kast expression.
+    /// Suggests moving the semicolon after a block to the inside of the block, after its last
+    /// expression.
     ///
     /// ### Why is this bad?
     ///
-    /// For consistency it's best to have the semicolon inside/outside the block. Either way is fine and this lint suggests inside the block.
+    /// For consistency it's best to have the semicolon inside/outside the block. Either way is fine
+    /// and this lint suggests inside the block.
     /// Take a look at `semicolon_outside_block` for the other alternative.
     ///
     /// ### Example
@@ -40,7 +42,8 @@
     ///
     /// ### Why is this bad?
     ///
-    /// For consistency it's best to have the semicolon inside/outside the block. Either way is fine and this lint suggests outside the block.
+    /// For consistency it's best to have the semicolon inside/outside the block. Either way is fine
+    /// and this lint suggests outside the block.
     /// Take a look at `semicolon_inside_block` for the other alternative.
     ///
     /// ### Example
index 4cd112dd5e12cdaa3b1019e78bfea7f78c993c8a..42e97e1ca358e145bd51d8d464dfd77d365d3069 100644 (file)
@@ -79,5 +79,7 @@ fn main() {
         unit_fn_block()
     };
 
+    { unit_fn_block(); };
+
     unit_fn_block()
 }
index 7512125c051d3efa20074490017d82b465860bed..f40848f702e1cbabd76a1a55c26fde7425a90f6b 100644 (file)
@@ -79,5 +79,7 @@ fn main() {
         unit_fn_block()
     };
 
+    { unit_fn_block(); };
+
     unit_fn_block()
 }
index 5bc18faaad8ec47da3273653d6ab18cb59c07db3..091eaa7518e95d1750a3c1fc59ecd27479c7835a 100644 (file)
@@ -79,5 +79,7 @@ fn main() {
         unit_fn_block()
     };
 
+    { unit_fn_block(); };
+
     unit_fn_block()
 }
index 0a42932387630e851a183c53819aac5a607beaf4..7ce46431fac9ace2c0c4221bb32348a7c866f1b7 100644 (file)
@@ -79,5 +79,7 @@ fn main() {
         unit_fn_block()
     };
 
+    { unit_fn_block(); };
+
     unit_fn_block()
 }