Skip to content

Commit b3b9f31

Browse files
committed
Bump indexmap
`swap` has been deprecated in favour of `swap_remove` - the behaviour is the same though.
1 parent 41227f9 commit b3b9f31

File tree

7 files changed

+20
-10
lines changed

7 files changed

+20
-10
lines changed

clippy_lints/src/copies.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -511,7 +511,8 @@ fn scan_block_for_eq<'tcx>(
511511
for stmt in &stmts[stmts.len() - init..=stmts.len() - offset] {
512512
if let StmtKind::Local(l) = stmt.kind {
513513
l.pat.each_binding_or_first(&mut |_, id, _, _| {
514-
eq.locals.remove(&id);
514+
// FIXME(rust/#120456) - is `swap_remove` correct?
515+
eq.locals.swap_remove(&id);
515516
});
516517
}
517518
}

clippy_lints/src/escape.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,15 +138,17 @@ impl<'a, 'tcx> Delegate<'tcx> for EscapeDelegate<'a, 'tcx> {
138138
fn consume(&mut self, cmt: &PlaceWithHirId<'tcx>, _: HirId) {
139139
if cmt.place.projections.is_empty() {
140140
if let PlaceBase::Local(lid) = cmt.place.base {
141-
self.set.remove(&lid);
141+
// FIXME(rust/#120456) - is `swap_remove` correct?
142+
self.set.swap_remove(&lid);
142143
}
143144
}
144145
}
145146

146147
fn borrow(&mut self, cmt: &PlaceWithHirId<'tcx>, _: HirId, _: ty::BorrowKind) {
147148
if cmt.place.projections.is_empty() {
148149
if let PlaceBase::Local(lid) = cmt.place.base {
149-
self.set.remove(&lid);
150+
// FIXME(rust/#120456) - is `swap_remove` correct?
151+
self.set.swap_remove(&lid);
150152
}
151153
}
152154
}

clippy_lints/src/index_refutable_slice.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,8 @@ fn find_slice_values(cx: &LateContext<'_>, pat: &hir::Pat<'_>) -> FxIndexMap<hir
106106
}
107107
if sub_pat.is_some() {
108108
removed_pat.insert(value_hir_id);
109-
slices.remove(&value_hir_id);
109+
// FIXME(rust/#120456) - is `swap_remove` correct?
110+
slices.swap_remove(&value_hir_id);
110111
return;
111112
}
112113

@@ -259,7 +260,8 @@ impl<'a, 'tcx> Visitor<'tcx> for SliceIndexLintingVisitor<'a, 'tcx> {
259260
}
260261

261262
// The slice was used for something other than indexing
262-
self.slice_lint_info.remove(&local_id);
263+
// FIXME(rust/#120456) - is `swap_remove` correct?
264+
self.slice_lint_info.swap_remove(&local_id);
263265
}
264266
intravisit::walk_expr(self, expr);
265267
}

clippy_lints/src/matches/match_same_arms.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -415,6 +415,7 @@ fn pat_contains_local(pat: &Pat<'_>, id: HirId) -> bool {
415415
/// Returns true if all the bindings in the `Pat` are in `ids` and vice versa
416416
fn bindings_eq(pat: &Pat<'_>, mut ids: HirIdSet) -> bool {
417417
let mut result = true;
418-
pat.each_binding_or_first(&mut |_, id, _, _| result &= ids.remove(&id));
418+
// FIXME(rust/#120456) - is `swap_remove` correct?
419+
pat.each_binding_or_first(&mut |_, id, _, _| result &= ids.swap_remove(&id));
419420
result && ids.is_empty()
420421
}

clippy_lints/src/needless_pass_by_ref_mut.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,8 @@ impl<'tcx> euv::Delegate<'tcx> for MutablyUsedVariablesCtxt<'tcx> {
382382
self.add_mutably_used_var(*vid);
383383
}
384384
self.prev_bind = None;
385-
self.prev_move_to_closure.remove(vid);
385+
// FIXME(rust/#120456) - is `swap_remove` correct?
386+
self.prev_move_to_closure.swap_remove(vid);
386387
}
387388
}
388389

clippy_lints/src/no_effect.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,8 @@ impl<'tcx> LateLintPass<'tcx> for NoEffect {
9898

9999
fn check_block_post(&mut self, cx: &LateContext<'tcx>, _: &'tcx rustc_hir::Block<'tcx>) {
100100
for hir_id in self.local_bindings.pop().unwrap() {
101-
if let Some(span) = self.underscore_bindings.remove(&hir_id) {
101+
// FIXME(rust/#120456) - is `swap_remove` correct?
102+
if let Some(span) = self.underscore_bindings.swap_remove(&hir_id) {
102103
span_lint_hir(
103104
cx,
104105
NO_EFFECT_UNDERSCORE_BINDING,
@@ -112,7 +113,8 @@ impl<'tcx> LateLintPass<'tcx> for NoEffect {
112113

113114
fn check_expr(&mut self, _: &LateContext<'tcx>, expr: &'tcx rustc_hir::Expr<'tcx>) {
114115
if let Some(def_id) = path_to_local(expr) {
115-
self.underscore_bindings.remove(&def_id);
116+
// FIXME(rust/#120456) - is `swap_remove` correct?
117+
self.underscore_bindings.swap_remove(&def_id);
116118
}
117119
}
118120
}

clippy_lints/src/only_used_in_recursion.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,8 @@ impl Params {
153153
param.uses = Vec::new();
154154
let key = (param.fn_id, param.idx);
155155
self.by_fn.remove(&key);
156-
self.by_id.remove(&id);
156+
// FIXME(rust/#120456) - is `swap_remove` correct?
157+
self.by_id.swap_remove(&id);
157158
}
158159
}
159160

0 commit comments

Comments
 (0)