Skip to content

Commit 2fcd542

Browse files
committed
Remove is_autoref parameter
1 parent 12d8ca1 commit 2fcd542

File tree

8 files changed

+12
-22
lines changed

8 files changed

+12
-22
lines changed

compiler/rustc_typeck/src/check/generator_interior/drop_ranges/record_consumed_borrow.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -103,11 +103,10 @@ impl<'tcx> expr_use_visitor::Delegate<'tcx> for ExprUseDelegate<'tcx> {
103103
place_with_id: &expr_use_visitor::PlaceWithHirId<'tcx>,
104104
diag_expr_id: HirId,
105105
bk: rustc_middle::ty::BorrowKind,
106-
is_autoref: bool,
107106
) {
108107
debug!(
109108
"borrow: place_with_id = {place_with_id:?}, diag_expr_id={diag_expr_id:?}, \
110-
borrow_kind={bk:?}, is_autoref={is_autoref}"
109+
borrow_kind={bk:?}"
111110
);
112111

113112
self.places

compiler/rustc_typeck/src/check/upvar.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -1792,7 +1792,6 @@ impl<'a, 'tcx> euv::Delegate<'tcx> for InferBorrowKind<'a, 'tcx> {
17921792
place_with_id: &PlaceWithHirId<'tcx>,
17931793
diag_expr_id: hir::HirId,
17941794
bk: ty::BorrowKind,
1795-
_is_autoref: bool,
17961795
) {
17971796
let PlaceBase::Upvar(upvar_id) = place_with_id.place.base else { return };
17981797
assert_eq!(self.closure_def_id, upvar_id.closure_expr_id);
@@ -1827,7 +1826,7 @@ impl<'a, 'tcx> euv::Delegate<'tcx> for InferBorrowKind<'a, 'tcx> {
18271826

18281827
#[instrument(skip(self), level = "debug")]
18291828
fn mutate(&mut self, assignee_place: &PlaceWithHirId<'tcx>, diag_expr_id: hir::HirId) {
1830-
self.borrow(assignee_place, diag_expr_id, ty::BorrowKind::MutBorrow, false);
1829+
self.borrow(assignee_place, diag_expr_id, ty::BorrowKind::MutBorrow);
18311830
}
18321831
}
18331832

compiler/rustc_typeck/src/expr_use_visitor.rs

+5-13
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,14 @@ pub trait Delegate<'tcx> {
4545
place_with_id: &PlaceWithHirId<'tcx>,
4646
diag_expr_id: hir::HirId,
4747
bk: ty::BorrowKind,
48-
is_autoref: bool,
4948
);
5049

5150
/// The value found at `place` is being copied.
5251
/// `diag_expr_id` is the id used for diagnostics (see `consume` for more details).
5352
fn copy(&mut self, place_with_id: &PlaceWithHirId<'tcx>, diag_expr_id: hir::HirId) {
5453
// In most cases, copying data from `x` is equivalent to doing `*&x`, so by default
5554
// we treat a copy of `x` as a borrow of `x`.
56-
self.borrow(place_with_id, diag_expr_id, ty::BorrowKind::ImmBorrow, false)
55+
self.borrow(place_with_id, diag_expr_id, ty::BorrowKind::ImmBorrow)
5756
}
5857

5958
/// The path at `assignee_place` is being assigned to.
@@ -184,7 +183,7 @@ impl<'a, 'tcx> ExprUseVisitor<'a, 'tcx> {
184183
debug!("borrow_expr(expr={:?}, bk={:?})", expr, bk);
185184

186185
let place_with_id = return_if_err!(self.mc.cat_expr(expr));
187-
self.delegate.borrow(&place_with_id, place_with_id.hir_id, bk, false);
186+
self.delegate.borrow(&place_with_id, place_with_id.hir_id, bk);
188187

189188
self.walk_expr(expr)
190189
}
@@ -567,7 +566,7 @@ impl<'a, 'tcx> ExprUseVisitor<'a, 'tcx> {
567566
// this is an autoref of `x`.
568567
adjustment::Adjust::Deref(Some(ref deref)) => {
569568
let bk = ty::BorrowKind::from_mutbl(deref.mutbl);
570-
self.delegate.borrow(&place_with_id, place_with_id.hir_id, bk, true);
569+
self.delegate.borrow(&place_with_id, place_with_id.hir_id, bk);
571570
}
572571

573572
adjustment::Adjust::Borrow(ref autoref) => {
@@ -599,19 +598,13 @@ impl<'a, 'tcx> ExprUseVisitor<'a, 'tcx> {
599598
base_place,
600599
base_place.hir_id,
601600
ty::BorrowKind::from_mutbl(m.into()),
602-
true,
603601
);
604602
}
605603

606604
adjustment::AutoBorrow::RawPtr(m) => {
607605
debug!("walk_autoref: expr.hir_id={} base_place={:?}", expr.hir_id, base_place);
608606

609-
self.delegate.borrow(
610-
base_place,
611-
base_place.hir_id,
612-
ty::BorrowKind::from_mutbl(m),
613-
true,
614-
);
607+
self.delegate.borrow(base_place, base_place.hir_id, ty::BorrowKind::from_mutbl(m));
615608
}
616609
}
617610
}
@@ -684,7 +677,7 @@ impl<'a, 'tcx> ExprUseVisitor<'a, 'tcx> {
684677
match bm {
685678
ty::BindByReference(m) => {
686679
let bk = ty::BorrowKind::from_mutbl(m);
687-
delegate.borrow(place, discr_place.hir_id, bk, false);
680+
delegate.borrow(place, discr_place.hir_id, bk);
688681
}
689682
ty::BindByValue(..) => {
690683
debug!("walk_pat binding consuming pat");
@@ -814,7 +807,6 @@ impl<'a, 'tcx> ExprUseVisitor<'a, 'tcx> {
814807
&place_with_id,
815808
place_with_id.hir_id,
816809
upvar_borrow,
817-
false,
818810
);
819811
}
820812
}

src/tools/clippy/clippy_lints/src/escape.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ impl<'a, 'tcx> Delegate<'tcx> for EscapeDelegate<'a, 'tcx> {
154154
}
155155
}
156156

157-
fn borrow(&mut self, cmt: &PlaceWithHirId<'tcx>, _: HirId, _: ty::BorrowKind, _is_autoref: bool) {
157+
fn borrow(&mut self, cmt: &PlaceWithHirId<'tcx>, _: HirId, _: ty::BorrowKind) {
158158
if cmt.place.projections.is_empty() {
159159
if let PlaceBase::Local(lid) = cmt.place.base {
160160
self.set.remove(&lid);

src/tools/clippy/clippy_lints/src/loops/mut_range_bound.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ struct MutatePairDelegate<'a, 'tcx> {
9090
impl<'tcx> Delegate<'tcx> for MutatePairDelegate<'_, 'tcx> {
9191
fn consume(&mut self, _: &PlaceWithHirId<'tcx>, _: HirId) {}
9292

93-
fn borrow(&mut self, cmt: &PlaceWithHirId<'tcx>, diag_expr_id: HirId, bk: ty::BorrowKind, _is_autoref: bool) {
93+
fn borrow(&mut self, cmt: &PlaceWithHirId<'tcx>, diag_expr_id: HirId, bk: ty::BorrowKind) {
9494
if bk == ty::BorrowKind::MutBorrow {
9595
if let PlaceBase::Local(id) = cmt.place.base {
9696
if Some(id) == self.hir_id_low && !BreakAfterExprVisitor::is_found(self.cx, diag_expr_id) {

src/tools/clippy/clippy_lints/src/needless_pass_by_value.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ impl<'tcx> euv::Delegate<'tcx> for MovedVariablesCtxt {
332332
self.move_common(cmt);
333333
}
334334

335-
fn borrow(&mut self, _: &euv::PlaceWithHirId<'tcx>, _: HirId, _: ty::BorrowKind, _is_autoref: bool) {}
335+
fn borrow(&mut self, _: &euv::PlaceWithHirId<'tcx>, _: HirId, _: ty::BorrowKind) {}
336336

337337
fn mutate(&mut self, _: &euv::PlaceWithHirId<'tcx>, _: HirId) {}
338338

src/tools/clippy/clippy_utils/src/sugg.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -886,7 +886,7 @@ impl<'tcx> Delegate<'tcx> for DerefDelegate<'_, 'tcx> {
886886
fn consume(&mut self, _: &PlaceWithHirId<'tcx>, _: HirId) {}
887887

888888
#[allow(clippy::too_many_lines)]
889-
fn borrow(&mut self, cmt: &PlaceWithHirId<'tcx>, _: HirId, _: ty::BorrowKind, _is_autoref: bool) {
889+
fn borrow(&mut self, cmt: &PlaceWithHirId<'tcx>, _: HirId, _: ty::BorrowKind) {
890890
if let PlaceBase::Local(id) = cmt.place.base {
891891
let map = self.cx.tcx.hir();
892892
let span = map.span(cmt.hir_id);

src/tools/clippy/clippy_utils/src/usage.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ impl<'tcx> MutVarsDelegate {
6464
impl<'tcx> Delegate<'tcx> for MutVarsDelegate {
6565
fn consume(&mut self, _: &PlaceWithHirId<'tcx>, _: HirId) {}
6666

67-
fn borrow(&mut self, cmt: &PlaceWithHirId<'tcx>, _: HirId, bk: ty::BorrowKind, _is_autoref: bool) {
67+
fn borrow(&mut self, cmt: &PlaceWithHirId<'tcx>, _: HirId, bk: ty::BorrowKind) {
6868
if bk == ty::BorrowKind::MutBorrow {
6969
self.update(cmt);
7070
}

0 commit comments

Comments
 (0)