Skip to content

Commit 371b174

Browse files
committed
misc: move is_expr_temporary_value check into let-chain
we return `false` outside of the `if` anyway
1 parent 355e4ba commit 371b174

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

clippy_lints/src/casts/borrow_as_ptr.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,11 @@ pub(super) fn check<'tcx>(
2222
&& !matches!(target.ty.kind, TyKind::TraitObject(..))
2323
&& let ExprKind::AddrOf(BorrowKind::Ref, mutability, e) = cast_expr.kind
2424
&& !is_lint_allowed(cx, BORROW_AS_PTR, expr.hir_id)
25+
// Fix #9884
26+
&& !is_expr_temporary_value(cx, e)
2527
{
2628
let mut app = Applicability::MachineApplicable;
2729
let snip = snippet_with_context(cx, e.span, cast_expr.span.ctxt(), "..", &mut app).0;
28-
// Fix #9884
29-
if is_expr_temporary_value(cx, e) {
30-
return false;
31-
}
3230

3331
let (suggestion, span) = if msrv.meets(cx, msrvs::RAW_REF_OP) {
3432
// Make sure that the span to be replaced doesn't include parentheses, that could break the

0 commit comments

Comments
 (0)