diff options
| author | Ada Alakbarova <ada.alakbarova@proton.me> | 2025-08-13 11:03:56 +0200 |
|---|---|---|
| committer | Ada Alakbarova <ada.alakbarova@proton.me> | 2025-08-13 19:35:31 +0200 |
| commit | 371b1747115d240696cef30657bd0ee99aab19d2 (patch) | |
| tree | 53b531de941d0bd296184b67ab3715ac5d748b4d | |
| parent | 355e4bacf57c9d8ea98bc064f4f56f3945357712 (diff) | |
misc: move `is_expr_temporary_value` check into let-chain
we return `false` outside of the `if` anyway
| -rw-r--r-- | clippy_lints/src/casts/borrow_as_ptr.rs | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/clippy_lints/src/casts/borrow_as_ptr.rs b/clippy_lints/src/casts/borrow_as_ptr.rs index e3b125a8d5b..b84ff008eb8 100644 --- a/clippy_lints/src/casts/borrow_as_ptr.rs +++ b/clippy_lints/src/casts/borrow_as_ptr.rs @@ -22,13 +22,11 @@ pub(super) fn check<'tcx>( && !matches!(target.ty.kind, TyKind::TraitObject(..)) && let ExprKind::AddrOf(BorrowKind::Ref, mutability, e) = cast_expr.kind && !is_lint_allowed(cx, BORROW_AS_PTR, expr.hir_id) + // Fix #9884 + && !is_expr_temporary_value(cx, e) { let mut app = Applicability::MachineApplicable; let snip = snippet_with_context(cx, e.span, cast_expr.span.ctxt(), "..", &mut app).0; - // Fix #9884 - if is_expr_temporary_value(cx, e) { - return false; - } let (suggestion, span) = if msrv.meets(cx, msrvs::RAW_REF_OP) { // Make sure that the span to be replaced doesn't include parentheses, that could break the |
