diff options
| author | Lukas Wirth <lukastw97@gmail.com> | 2022-12-05 11:02:10 +0100 |
|---|---|---|
| committer | Lukas Wirth <lukastw97@gmail.com> | 2022-12-05 11:02:10 +0100 |
| commit | 20ec2ceab8450e1a0611fbc54a17a03ffc0bd39b (patch) | |
| tree | 2d581fca854a4bfbf376b3be83119baca8dbd9a9 | |
| parent | f62eab43123ac463d7ff95590c285cb30e86b1f7 (diff) | |
| download | rust-20ec2ceab8450e1a0611fbc54a17a03ffc0bd39b.tar.gz rust-20ec2ceab8450e1a0611fbc54a17a03ffc0bd39b.zip | |
Add test case for blocks with semicolon inside and outside a block
| -rw-r--r-- | clippy_lints/src/semicolon_block.rs | 9 | ||||
| -rw-r--r-- | tests/ui/semicolon_inside_block.fixed | 2 | ||||
| -rw-r--r-- | tests/ui/semicolon_inside_block.rs | 2 | ||||
| -rw-r--r-- | tests/ui/semicolon_outside_block.fixed | 2 | ||||
| -rw-r--r-- | tests/ui/semicolon_outside_block.rs | 2 |
5 files changed, 14 insertions, 3 deletions
diff --git a/clippy_lints/src/semicolon_block.rs b/clippy_lints/src/semicolon_block.rs index d3cab68137c..8f1d1490e1f 100644 --- a/clippy_lints/src/semicolon_block.rs +++ b/clippy_lints/src/semicolon_block.rs @@ -8,11 +8,13 @@ use rustc_span::Span; 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 @@ declare_clippy_lint! { /// /// ### 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 diff --git a/tests/ui/semicolon_inside_block.fixed b/tests/ui/semicolon_inside_block.fixed index 4cd112dd5e1..42e97e1ca35 100644 --- a/tests/ui/semicolon_inside_block.fixed +++ b/tests/ui/semicolon_inside_block.fixed @@ -79,5 +79,7 @@ fn main() { unit_fn_block() }; + { unit_fn_block(); }; + unit_fn_block() } diff --git a/tests/ui/semicolon_inside_block.rs b/tests/ui/semicolon_inside_block.rs index 7512125c051..f40848f702e 100644 --- a/tests/ui/semicolon_inside_block.rs +++ b/tests/ui/semicolon_inside_block.rs @@ -79,5 +79,7 @@ fn main() { unit_fn_block() }; + { unit_fn_block(); }; + unit_fn_block() } diff --git a/tests/ui/semicolon_outside_block.fixed b/tests/ui/semicolon_outside_block.fixed index 5bc18faaad8..091eaa7518e 100644 --- a/tests/ui/semicolon_outside_block.fixed +++ b/tests/ui/semicolon_outside_block.fixed @@ -79,5 +79,7 @@ fn main() { unit_fn_block() }; + { unit_fn_block(); }; + unit_fn_block() } diff --git a/tests/ui/semicolon_outside_block.rs b/tests/ui/semicolon_outside_block.rs index 0a429323876..7ce46431fac 100644 --- a/tests/ui/semicolon_outside_block.rs +++ b/tests/ui/semicolon_outside_block.rs @@ -79,5 +79,7 @@ fn main() { unit_fn_block() }; + { unit_fn_block(); }; + unit_fn_block() } |
