Add test case for blocks with semicolon inside and outside a block

This commit is contained in:
Lukas Wirth 2022-12-05 11:02:10 +01:00
parent f62eab4312
commit 20ec2ceab8
5 changed files with 14 additions and 3 deletions

View file

@ -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

View file

@ -79,5 +79,7 @@ fn main() {
unit_fn_block()
};
{ unit_fn_block(); };
unit_fn_block()
}

View file

@ -79,5 +79,7 @@ fn main() {
unit_fn_block()
};
{ unit_fn_block(); };
unit_fn_block()
}

View file

@ -79,5 +79,7 @@ fn main() {
unit_fn_block()
};
{ unit_fn_block(); };
unit_fn_block()
}

View file

@ -79,5 +79,7 @@ fn main() {
unit_fn_block()
};
{ unit_fn_block(); };
unit_fn_block()
}