semicolon_if_nothing_returned now checks if the stmt ends with semicolon

This commit is contained in:
dswij 2021-11-10 14:46:00 +08:00
parent e8861c807a
commit a003ca6853

View File

@ -44,7 +44,7 @@ impl LateLintPass<'_> for SemicolonIfNothingReturned {
let t_expr = cx.typeck_results().expr_ty(expr);
if t_expr.is_unit();
if let snippet = snippet_with_macro_callsite(cx, expr.span, "}");
if !snippet.ends_with('}');
if !snippet.ends_with('}') && !snippet.ends_with(';');
if cx.sess().source_map().is_multiline(block.span);
then {
// filter out the desugared `for` loop