@@ -47,7 +47,7 @@ impl LateLintPass<'_> for SemicolonIfNothingReturned {
47
47
if t_expr. is_unit( ) ;
48
48
if let snippet = snippet_with_macro_callsite( cx, expr. span, "}" ) ;
49
49
if !snippet. ends_with( '}' ) ;
50
- if !check_if_inside_block_on_same_line ( cx , block, expr ) ;
50
+ if cx . sess ( ) . source_map ( ) . is_multiline ( block. span ) ;
51
51
then {
52
52
// filter out the desugared `for` loop
53
53
if let ExprKind :: DropTemps ( ..) = & expr. kind {
@@ -69,24 +69,3 @@ impl LateLintPass<'_> for SemicolonIfNothingReturned {
69
69
}
70
70
}
71
71
}
72
-
73
- /// Check if this block is inside a closure or an unsafe block or a normal on the same line.
74
- fn check_if_inside_block_on_same_line < ' tcx > (
75
- cx : & LateContext < ' tcx > ,
76
- block : & ' tcx Block < ' tcx > ,
77
- last_expr : & ' tcx Expr < ' _ > ,
78
- ) -> bool {
79
- if_chain ! {
80
- if let Some ( parent) = get_parent_expr_for_hir( cx, block. hir_id) ;
81
-
82
- if !matches!( block. rules, BlockCheckMode :: DefaultBlock ) ||
83
- matches!( parent. kind, ExprKind :: Closure ( ..) | ExprKind :: Block ( ..) ) ;
84
-
85
- if block. stmts. is_empty( ) ;
86
- then {
87
- let source_map = cx. sess( ) . source_map( ) ;
88
- return !source_map. is_multiline( parent. span. to( last_expr. span) ) ;
89
- }
90
- }
91
- false
92
- }
0 commit comments