Skip to content

Commit

Permalink
Auto merge of rust-lang#132301 - compiler-errors:adjust, r=lcnr
Browse files Browse the repository at this point in the history
Remove region from adjustments

It's not necessary to store this region, because it's only used in THIR and MemCat/ExprUse, both of which already basically only deal with erased regions anyways.
  • Loading branch information
bors committed Oct 31, 2024
2 parents d9a0fec + 353868a commit 9f89421
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion clippy_lints/src/dereference.rs
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ impl<'tcx> LateLintPass<'tcx> for Dereferencing<'tcx> {
let (required_refs, msg) = if can_auto_borrow {
(1, if deref_count == 1 { borrow_msg } else { deref_msg })
} else if let Some(&Adjustment {
kind: Adjust::Borrow(AutoBorrow::Ref(_, mutability)),
kind: Adjust::Borrow(AutoBorrow::Ref(mutability)),
..
}) = next_adjust
&& matches!(mutability, AutoBorrowMutability::Mut { .. })
Expand Down
4 changes: 2 additions & 2 deletions clippy_lints/src/loops/explicit_into_iter_loop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ pub(super) fn check(cx: &LateContext<'_>, self_arg: &Expr<'_>, call_expr: &Expr<
[] => AdjustKind::None,
&[
Adjustment {
kind: Adjust::Borrow(AutoBorrow::Ref(_, mutbl)),
kind: Adjust::Borrow(AutoBorrow::Ref(mutbl)),
..
},
] => AdjustKind::borrow(mutbl),
Expand All @@ -62,7 +62,7 @@ pub(super) fn check(cx: &LateContext<'_>, self_arg: &Expr<'_>, call_expr: &Expr<
kind: Adjust::Deref(_), ..
},
Adjustment {
kind: Adjust::Borrow(AutoBorrow::Ref(_, mutbl)),
kind: Adjust::Borrow(AutoBorrow::Ref(mutbl)),
target,
},
] => {
Expand Down
4 changes: 2 additions & 2 deletions clippy_lints/src/loops/explicit_iter_loop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ fn is_ref_iterable<'tcx>(
kind: Adjust::Deref(_), ..
},
Adjustment {
kind: Adjust::Borrow(AutoBorrow::Ref(_, mutbl)),
kind: Adjust::Borrow(AutoBorrow::Ref(mutbl)),
target,
},
..,
Expand Down Expand Up @@ -236,7 +236,7 @@ fn is_ref_iterable<'tcx>(
},
&[
Adjustment {
kind: Adjust::Borrow(AutoBorrow::Ref(_, mutbl)),
kind: Adjust::Borrow(AutoBorrow::Ref(mutbl)),
target,
},
..,
Expand Down
4 changes: 2 additions & 2 deletions clippy_lints/src/methods/manual_inspect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ pub(crate) fn check(cx: &LateContext<'_>, expr: &Expr<'_>, arg: &Expr<'_>, name:
_ if matches!(
typeck.expr_adjustments(prev_expr).first(),
Some(Adjustment {
kind: Adjust::Borrow(AutoBorrow::Ref(_, AutoBorrowMutability::Not))
kind: Adjust::Borrow(AutoBorrow::Ref(AutoBorrowMutability::Not))
| Adjust::Deref(_),
..
})
Expand Down Expand Up @@ -230,7 +230,7 @@ fn check_use<'tcx>(cx: &LateContext<'tcx>, e: &'tcx Expr<'_>) -> (UseKind<'tcx>,
if use_cx
.adjustments
.first()
.is_some_and(|a| matches!(a.kind, Adjust::Borrow(AutoBorrow::Ref(_, AutoBorrowMutability::Not)))) =>
.is_some_and(|a| matches!(a.kind, Adjust::Borrow(AutoBorrow::Ref(AutoBorrowMutability::Not)))) =>
{
UseKind::AutoBorrowed
},
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/redundant_slicing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ impl<'tcx> LateLintPass<'tcx> for RedundantSlicing {
) || cx.typeck_results().expr_adjustments(expr).first().map_or(false, |a| {
matches!(
a.kind,
Adjust::Borrow(AutoBorrow::Ref(_, AutoBorrowMutability::Mut { .. }))
Adjust::Borrow(AutoBorrow::Ref(AutoBorrowMutability::Mut { .. }))
)
}) || (matches!(
cx.typeck_results().expr_ty(indexed).ref_mutability(),
Expand Down

0 comments on commit 9f89421

Please sign in to comment.