Skip to content

Commit b6c80a6

Browse files
committed
Avoid even more decoding if not absolutely necessary
1 parent 9b040e9 commit b6c80a6

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

compiler/rustc_lint/src/dangling.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -131,10 +131,10 @@ impl DanglingPointerSearcher<'_, '_> {
131131
fn lint_expr(cx: &LateContext<'_>, expr: &Expr<'_>) {
132132
if let ExprKind::MethodCall(method, receiver, _args, _span) = expr.kind
133133
&& is_temporary_rvalue(receiver)
134-
&& let Some(fn_id) = cx.typeck_results().type_dependent_def_id(expr.hir_id)
135-
&& cx.tcx.has_attr(fn_id, sym::rustc_as_ptr)
136134
&& let ty = cx.typeck_results().expr_ty(receiver)
137135
&& owns_allocation(cx.tcx, ty)
136+
&& let Some(fn_id) = cx.typeck_results().type_dependent_def_id(expr.hir_id)
137+
&& cx.tcx.has_attr(fn_id, sym::rustc_as_ptr)
138138
{
139139
// FIXME: use `emit_node_lint` when `#[primary_span]` is added.
140140
cx.tcx.emit_node_span_lint(

0 commit comments

Comments
 (0)