Remove region from adjustments

This commit is contained in:
Michael Goulet 2024-10-29 01:34:06 +00:00
parent 303ab513d5
commit 353868aa64
5 changed files with 8 additions and 8 deletions

View file

@ -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 { .. })

View file

@ -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),
@ -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,
},
] => {

View file

@ -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,
},
..,
@ -236,7 +236,7 @@ fn is_ref_iterable<'tcx>(
},
&[
Adjustment {
kind: Adjust::Borrow(AutoBorrow::Ref(_, mutbl)),
kind: Adjust::Borrow(AutoBorrow::Ref(mutbl)),
target,
},
..,

View file

@ -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(_),
..
})
@ -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
},

View file

@ -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(),