mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-27 15:11:30 +00:00
Remove region from adjustments
This commit is contained in:
parent
303ab513d5
commit
353868aa64
5 changed files with 8 additions and 8 deletions
|
@ -418,7 +418,7 @@ impl<'tcx> LateLintPass<'tcx> for Dereferencing<'tcx> {
|
||||||
let (required_refs, msg) = if can_auto_borrow {
|
let (required_refs, msg) = if can_auto_borrow {
|
||||||
(1, if deref_count == 1 { borrow_msg } else { deref_msg })
|
(1, if deref_count == 1 { borrow_msg } else { deref_msg })
|
||||||
} else if let Some(&Adjustment {
|
} else if let Some(&Adjustment {
|
||||||
kind: Adjust::Borrow(AutoBorrow::Ref(_, mutability)),
|
kind: Adjust::Borrow(AutoBorrow::Ref(mutability)),
|
||||||
..
|
..
|
||||||
}) = next_adjust
|
}) = next_adjust
|
||||||
&& matches!(mutability, AutoBorrowMutability::Mut { .. })
|
&& matches!(mutability, AutoBorrowMutability::Mut { .. })
|
||||||
|
|
|
@ -53,7 +53,7 @@ pub(super) fn check(cx: &LateContext<'_>, self_arg: &Expr<'_>, call_expr: &Expr<
|
||||||
[] => AdjustKind::None,
|
[] => AdjustKind::None,
|
||||||
&[
|
&[
|
||||||
Adjustment {
|
Adjustment {
|
||||||
kind: Adjust::Borrow(AutoBorrow::Ref(_, mutbl)),
|
kind: Adjust::Borrow(AutoBorrow::Ref(mutbl)),
|
||||||
..
|
..
|
||||||
},
|
},
|
||||||
] => AdjustKind::borrow(mutbl),
|
] => AdjustKind::borrow(mutbl),
|
||||||
|
@ -62,7 +62,7 @@ pub(super) fn check(cx: &LateContext<'_>, self_arg: &Expr<'_>, call_expr: &Expr<
|
||||||
kind: Adjust::Deref(_), ..
|
kind: Adjust::Deref(_), ..
|
||||||
},
|
},
|
||||||
Adjustment {
|
Adjustment {
|
||||||
kind: Adjust::Borrow(AutoBorrow::Ref(_, mutbl)),
|
kind: Adjust::Borrow(AutoBorrow::Ref(mutbl)),
|
||||||
target,
|
target,
|
||||||
},
|
},
|
||||||
] => {
|
] => {
|
||||||
|
|
|
@ -199,7 +199,7 @@ fn is_ref_iterable<'tcx>(
|
||||||
kind: Adjust::Deref(_), ..
|
kind: Adjust::Deref(_), ..
|
||||||
},
|
},
|
||||||
Adjustment {
|
Adjustment {
|
||||||
kind: Adjust::Borrow(AutoBorrow::Ref(_, mutbl)),
|
kind: Adjust::Borrow(AutoBorrow::Ref(mutbl)),
|
||||||
target,
|
target,
|
||||||
},
|
},
|
||||||
..,
|
..,
|
||||||
|
@ -236,7 +236,7 @@ fn is_ref_iterable<'tcx>(
|
||||||
},
|
},
|
||||||
&[
|
&[
|
||||||
Adjustment {
|
Adjustment {
|
||||||
kind: Adjust::Borrow(AutoBorrow::Ref(_, mutbl)),
|
kind: Adjust::Borrow(AutoBorrow::Ref(mutbl)),
|
||||||
target,
|
target,
|
||||||
},
|
},
|
||||||
..,
|
..,
|
||||||
|
|
|
@ -137,7 +137,7 @@ pub(crate) fn check(cx: &LateContext<'_>, expr: &Expr<'_>, arg: &Expr<'_>, name:
|
||||||
_ if matches!(
|
_ if matches!(
|
||||||
typeck.expr_adjustments(prev_expr).first(),
|
typeck.expr_adjustments(prev_expr).first(),
|
||||||
Some(Adjustment {
|
Some(Adjustment {
|
||||||
kind: Adjust::Borrow(AutoBorrow::Ref(_, AutoBorrowMutability::Not))
|
kind: Adjust::Borrow(AutoBorrow::Ref(AutoBorrowMutability::Not))
|
||||||
| Adjust::Deref(_),
|
| Adjust::Deref(_),
|
||||||
..
|
..
|
||||||
})
|
})
|
||||||
|
@ -230,7 +230,7 @@ fn check_use<'tcx>(cx: &LateContext<'tcx>, e: &'tcx Expr<'_>) -> (UseKind<'tcx>,
|
||||||
if use_cx
|
if use_cx
|
||||||
.adjustments
|
.adjustments
|
||||||
.first()
|
.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
|
UseKind::AutoBorrowed
|
||||||
},
|
},
|
||||||
|
|
|
@ -110,7 +110,7 @@ impl<'tcx> LateLintPass<'tcx> for RedundantSlicing {
|
||||||
) || cx.typeck_results().expr_adjustments(expr).first().map_or(false, |a| {
|
) || cx.typeck_results().expr_adjustments(expr).first().map_or(false, |a| {
|
||||||
matches!(
|
matches!(
|
||||||
a.kind,
|
a.kind,
|
||||||
Adjust::Borrow(AutoBorrow::Ref(_, AutoBorrowMutability::Mut { .. }))
|
Adjust::Borrow(AutoBorrow::Ref(AutoBorrowMutability::Mut { .. }))
|
||||||
)
|
)
|
||||||
}) || (matches!(
|
}) || (matches!(
|
||||||
cx.typeck_results().expr_ty(indexed).ref_mutability(),
|
cx.typeck_results().expr_ty(indexed).ref_mutability(),
|
||||||
|
|
Loading…
Reference in a new issue