Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 27e69a8

Browse files
committed
apply is_expr_temporary_value to Clippy source
1 parent 2fda4f6 commit 27e69a8

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

clippy_lints/src/casts/borrow_as_ptr.rs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,10 @@ use clippy_utils::diagnostics::span_lint_and_sugg;
22
use clippy_utils::msrvs::Msrv;
33
use clippy_utils::source::{snippet_with_applicability, snippet_with_context};
44
use clippy_utils::sugg::has_enclosing_paren;
5-
use clippy_utils::{is_lint_allowed, msrvs, std_or_core};
5+
use clippy_utils::{is_expr_temporary_value, is_lint_allowed, msrvs, std_or_core};
66
use rustc_errors::Applicability;
77
use rustc_hir::{BorrowKind, Expr, ExprKind, Mutability, Ty, TyKind};
88
use rustc_lint::LateContext;
9-
use rustc_middle::ty::adjustment::Adjust;
109
use rustc_span::BytePos;
1110

1211
use super::BORROW_AS_PTR;
@@ -25,12 +24,7 @@ pub(super) fn check<'tcx>(
2524
let mut app = Applicability::MachineApplicable;
2625
let snip = snippet_with_context(cx, e.span, cast_expr.span.ctxt(), "..", &mut app).0;
2726
// Fix #9884
28-
if !e.is_place_expr(|base| {
29-
cx.typeck_results()
30-
.adjustments()
31-
.get(base.hir_id)
32-
.is_some_and(|x| x.iter().any(|adj| matches!(adj.kind, Adjust::Deref(_))))
33-
}) {
27+
if is_expr_temporary_value(cx, e) {
3428
return false;
3529
}
3630

0 commit comments

Comments
 (0)