Skip to content

Commit 0cd9b06

Browse files
committed
Small code style adjustments
1 parent 4fe3727 commit 0cd9b06

File tree

1 file changed

+17
-14
lines changed

1 file changed

+17
-14
lines changed

clippy_lints/src/returns.rs

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -210,22 +210,25 @@ fn check_final_expr<'tcx>(
210210
// if desugar of `do yeet`, don't lint
211211
if let Some(inner_expr) = inner
212212
&& let ExprKind::Call(path_expr, _) = inner_expr.kind
213-
&& let ExprKind::Path(QPath::LangItem(LangItem::TryTraitFromYeet, _, _)) = path_expr.kind {
214-
return;
213+
&& let ExprKind::Path(QPath::LangItem(LangItem::TryTraitFromYeet, _, _)) = path_expr.kind
214+
{
215+
return;
215216
}
216-
if cx.tcx.hir().attrs(expr.hir_id).is_empty() {
217-
let borrows = inner.map_or(false, |inner| last_statement_borrows(cx, inner));
218-
if !borrows {
219-
// check if expr return nothing
220-
let ret_span = if inner.is_none() && replacement == RetReplacement::Empty {
221-
extend_span_to_previous_non_ws(cx, peeled_drop_expr.span)
222-
} else {
223-
peeled_drop_expr.span
224-
};
225-
226-
emit_return_lint(cx, ret_span, semi_spans, inner.as_ref().map(|i| i.span), replacement);
227-
}
217+
if !cx.tcx.hir().attrs(expr.hir_id).is_empty() {
218+
return;
219+
}
220+
let borrows = inner.map_or(false, |inner| last_statement_borrows(cx, inner));
221+
if borrows {
222+
return;
228223
}
224+
// check if expr return nothing
225+
let ret_span = if inner.is_none() && replacement == RetReplacement::Empty {
226+
extend_span_to_previous_non_ws(cx, peeled_drop_expr.span)
227+
} else {
228+
peeled_drop_expr.span
229+
};
230+
231+
emit_return_lint(cx, ret_span, semi_spans, inner.as_ref().map(|i| i.span), replacement);
229232
},
230233
ExprKind::If(_, then, else_clause_opt) => {
231234
check_block_return(cx, &then.kind, semi_spans.clone());

0 commit comments

Comments
 (0)