Skip to content

Commit 7bbe15e

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

File tree

25 files changed

+34
-34
lines changed

25 files changed

+34
-34
lines changed

Cargo.lock

+2-2
Original file line numberDiff line numberDiff line change
@@ -1968,9 +1968,9 @@ checksum = "ce23b50ad8242c51a442f3ff322d56b02f08852c77e4c0b4d3fd684abc89c683"
19681968

19691969
[[package]]
19701970
name = "indexmap"
1971-
version = "2.0.0"
1971+
version = "2.2.0"
19721972
source = "registry+https://github.com/rust-lang/crates.io-index"
1973-
checksum = "d5477fe2230a79769d8dc68e0eabf5437907c0457a5614a9e8dddb67f65eb65d"
1973+
checksum = "cf2a4f498956c7723dc280afc6a37d0dec50b39a29e232c6187ce4503703e8c2"
19741974
dependencies = [
19751975
"equivalent",
19761976
"hashbrown",

compiler/rustc_borrowck/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2473,7 +2473,7 @@ mod error {
24732473
&mut self,
24742474
span: Span,
24752475
) -> Option<(DiagnosticBuilder<'tcx>, usize)> {
2476-
self.errors.buffered_mut_errors.remove(&span)
2476+
self.errors.buffered_mut_errors.swap_remove(&span)
24772477
}
24782478

24792479
pub fn buffer_mut_error(&mut self, span: Span, t: DiagnosticBuilder<'tcx>, count: usize) {

compiler/rustc_borrowck/src/used_muts.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ impl GatherUsedMutsVisitor<'_, '_, '_> {
6060
// be those that were never initialized - we will consider those as being used as
6161
// they will either have been removed by unreachable code optimizations; or linted
6262
// as unused variables.
63-
self.never_initialized_mut_locals.remove(&into.local);
63+
self.never_initialized_mut_locals.swap_remove(&into.local);
6464
}
6565
}
6666

compiler/rustc_codegen_ssa/src/target_features.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ fn asm_target_features(tcx: TyCtxt<'_>, did: DefId) -> &FxIndexSet<Symbol> {
104104
match attrs.instruction_set {
105105
None => {}
106106
Some(InstructionSetAttr::ArmA32) => {
107-
target_features.remove(&sym::thumb_mode);
107+
target_features.swap_remove(&sym::thumb_mode);
108108
}
109109
Some(InstructionSetAttr::ArmT32) => {
110110
target_features.insert(sym::thumb_mode);

compiler/rustc_const_eval/src/const_eval/machine.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ impl<K: Hash + Eq, V> interpret::AllocMap<K, V> for FxIndexMap<K, V> {
125125
where
126126
K: Borrow<Q>,
127127
{
128-
FxIndexMap::remove(self, k)
128+
FxIndexMap::swap_remove(self, k)
129129
}
130130

131131
#[inline(always)]

compiler/rustc_const_eval/src/interpret/intern.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ fn intern_shallow<'rt, 'mir, 'tcx, T, M: CompileTimeMachine<'mir, 'tcx, T>>(
5050
) -> Result<(), ()> {
5151
trace!("intern_shallow {:?}", alloc_id);
5252
// remove allocation
53-
let Some((_kind, mut alloc)) = ecx.memory.alloc_map.remove(&alloc_id) else {
53+
let Some((_kind, mut alloc)) = ecx.memory.alloc_map.swap_remove(&alloc_id) else {
5454
return Err(());
5555
};
5656
// Set allocation mutability as appropriate. This is used by LLVM to put things into

compiler/rustc_errors/src/emitter.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1640,7 +1640,7 @@ impl HumanEmitter {
16401640
let mut to_add = FxHashMap::default();
16411641

16421642
for (depth, style) in depths {
1643-
if multilines.remove(&depth).is_none() {
1643+
if multilines.swap_remove(&depth).is_none() {
16441644
to_add.insert(depth, style);
16451645
}
16461646
}

compiler/rustc_errors/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -692,7 +692,7 @@ impl DiagCtxt {
692692
pub fn steal_diagnostic(&self, span: Span, key: StashKey) -> Option<DiagnosticBuilder<'_, ()>> {
693693
let mut inner = self.inner.borrow_mut();
694694
let key = (span.with_parent(None), key);
695-
let diag = inner.stashed_diagnostics.remove(&key)?;
695+
let diag = inner.stashed_diagnostics.swap_remove(&key)?;
696696
if diag.is_error() {
697697
if diag.is_lint.is_some() {
698698
inner.lint_err_count -= 1;

compiler/rustc_hir_analysis/src/astconv/object_safety.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
218218
for def_ids in associated_types.values_mut() {
219219
for (projection_bound, span) in &projection_bounds {
220220
let def_id = projection_bound.projection_def_id();
221-
def_ids.remove(&def_id);
221+
def_ids.swap_remove(&def_id);
222222
if tcx.generics_require_sized_self(def_id) {
223223
tcx.emit_node_span_lint(
224224
UNUSED_ASSOCIATED_TYPE_BOUNDS,

compiler/rustc_hir_analysis/src/collect/resolve_bound_vars.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1872,7 +1872,7 @@ impl<'a, 'tcx> BoundVarContext<'a, 'tcx> {
18721872
lifetime_ref: &'tcx hir::Lifetime,
18731873
bad_def: ResolvedArg,
18741874
) {
1875-
let old_value = self.map.defs.remove(&lifetime_ref.hir_id);
1875+
let old_value = self.map.defs.swap_remove(&lifetime_ref.hir_id);
18761876
assert_eq!(old_value, Some(bad_def));
18771877
}
18781878
}

compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1549,7 +1549,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
15491549
let ctxt = {
15501550
let mut enclosing_breakables = self.enclosing_breakables.borrow_mut();
15511551
debug_assert!(enclosing_breakables.stack.len() == index + 1);
1552-
enclosing_breakables.by_id.remove(&id).expect("missing breakable context");
1552+
enclosing_breakables.by_id.swap_remove(&id).expect("missing breakable context");
15531553
enclosing_breakables.stack.pop().expect("missing breakable context")
15541554
};
15551555
(ctxt, result)

compiler/rustc_infer/src/infer/opaque_types/table.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ impl<'tcx> OpaqueTypeStorage<'tcx> {
2020
if let Some(idx) = idx {
2121
self.opaque_types.get_mut(&key).unwrap().hidden_type = idx;
2222
} else {
23-
match self.opaque_types.remove(&key) {
23+
match self.opaque_types.swap_remove(&key) {
2424
None => bug!("reverted opaque type inference that was never registered: {:?}", key),
2525
Some(_) => {}
2626
}

compiler/rustc_lint_defs/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -712,7 +712,7 @@ impl LintBuffer {
712712
}
713713

714714
pub fn take(&mut self, id: NodeId) -> Vec<BufferedEarlyLint> {
715-
self.map.remove(&id).unwrap_or_default()
715+
self.map.swap_remove(&id).unwrap_or_default()
716716
}
717717

718718
pub fn buffer_lint(

compiler/rustc_mir_transform/src/dest_prop.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,7 @@ impl<'alloc> Candidates<'alloc> {
398398
let candidates = entry.get_mut();
399399
Self::vec_filter_candidates(p, candidates, f, at);
400400
if candidates.len() == 0 {
401-
entry.remove();
401+
entry.swap_remove();
402402
}
403403
}
404404

compiler/rustc_passes/src/stability.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -957,8 +957,8 @@ pub fn check_unused_or_stable_features(tcx: TyCtxt<'_>) {
957957
// available as we'd like it to be.
958958
// FIXME: only remove `libc` when `stdbuild` is active.
959959
// FIXME: remove special casing for `test`.
960-
remaining_lib_features.remove(&sym::libc);
961-
remaining_lib_features.remove(&sym::test);
960+
remaining_lib_features.swap_remove(&sym::libc);
961+
remaining_lib_features.swap_remove(&sym::test);
962962

963963
/// For each feature in `defined_features`..
964964
///
@@ -996,7 +996,7 @@ pub fn check_unused_or_stable_features(tcx: TyCtxt<'_>) {
996996
unnecessary_stable_feature_lint(tcx, *span, feature, since);
997997
}
998998
}
999-
remaining_lib_features.remove(&feature);
999+
remaining_lib_features.swap_remove(&feature);
10001000

10011001
// `feature` is the feature doing the implying, but `implied_by` is the feature with
10021002
// the attribute that establishes this relationship. `implied_by` is guaranteed to be a

compiler/rustc_resolve/src/check_unused.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ impl<'a, 'b, 'tcx> UnusedImportCheckVisitor<'a, 'b, 'tcx> {
9292
} else {
9393
// This trait import is definitely used, in a way other than
9494
// method resolution.
95-
self.r.maybe_unused_trait_imports.remove(&def_id);
95+
self.r.maybe_unused_trait_imports.swap_remove(&def_id);
9696
if let Some(i) = self.unused_imports.get_mut(&self.base_id) {
9797
i.unused.remove(&id);
9898
}

compiler/rustc_trait_selection/src/traits/auto_trait.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -523,13 +523,13 @@ impl<'tcx> AutoTraitFinder<'tcx> {
523523
if let Entry::Occupied(v) = vid_map.entry(*smaller) {
524524
let smaller_deps = v.into_mut();
525525
smaller_deps.larger.insert(*larger);
526-
smaller_deps.larger.remove(&target);
526+
smaller_deps.larger.swap_remove(&target);
527527
}
528528

529529
if let Entry::Occupied(v) = vid_map.entry(*larger) {
530530
let larger_deps = v.into_mut();
531531
larger_deps.smaller.insert(*smaller);
532-
larger_deps.smaller.remove(&target);
532+
larger_deps.smaller.swap_remove(&target);
533533
}
534534
}
535535
(&RegionTarget::RegionVid(v1), &RegionTarget::Region(r1)) => {
@@ -542,13 +542,13 @@ impl<'tcx> AutoTraitFinder<'tcx> {
542542
if let Entry::Occupied(v) = vid_map.entry(*smaller) {
543543
let smaller_deps = v.into_mut();
544544
smaller_deps.larger.insert(*larger);
545-
smaller_deps.larger.remove(&target);
545+
smaller_deps.larger.swap_remove(&target);
546546
}
547547

548548
if let Entry::Occupied(v) = vid_map.entry(*larger) {
549549
let larger_deps = v.into_mut();
550550
larger_deps.smaller.insert(*smaller);
551-
larger_deps.smaller.remove(&target);
551+
larger_deps.smaller.swap_remove(&target);
552552
}
553553
}
554554
}

compiler/rustc_trait_selection/src/traits/specialize/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -516,7 +516,7 @@ pub(crate) fn to_pretty_impl_header(tcx: TyCtxt<'_>, impl_def_id: DefId) -> Opti
516516
for (p, _) in predicates {
517517
if let Some(poly_trait_ref) = p.as_trait_clause() {
518518
if Some(poly_trait_ref.def_id()) == sized_trait {
519-
types_without_default_bounds.remove(&poly_trait_ref.self_ty().skip_binder());
519+
types_without_default_bounds.swap_remove(&poly_trait_ref.self_ty().skip_binder());
520520
continue;
521521
}
522522
}

src/tools/clippy/clippy_lints/src/copies.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -511,7 +511,7 @@ 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+
eq.locals.swap_remove(&id);
515515
});
516516
}
517517
}

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -138,15 +138,15 @@ 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+
self.set.swap_remove(&lid);
142142
}
143143
}
144144
}
145145

146146
fn borrow(&mut self, cmt: &PlaceWithHirId<'tcx>, _: HirId, _: ty::BorrowKind) {
147147
if cmt.place.projections.is_empty() {
148148
if let PlaceBase::Local(lid) = cmt.place.base {
149-
self.set.remove(&lid);
149+
self.set.swap_remove(&lid);
150150
}
151151
}
152152
}

src/tools/clippy/clippy_lints/src/index_refutable_slice.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ 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+
slices.swap_remove(&value_hir_id);
110110
return;
111111
}
112112

@@ -264,7 +264,7 @@ impl<'a, 'tcx> Visitor<'tcx> for SliceIndexLintingVisitor<'a, 'tcx> {
264264
}
265265

266266
// The slice was used for something other than indexing
267-
self.slice_lint_info.remove(&local_id);
267+
self.slice_lint_info.swap_remove(&local_id);
268268
}
269269
intravisit::walk_expr(self, expr);
270270
}

src/tools/clippy/clippy_lints/src/matches/match_same_arms.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -415,6 +415,6 @@ 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+
pat.each_binding_or_first(&mut |_, id, _, _| result &= ids.swap_remove(&id));
419419
result && ids.is_empty()
420420
}

src/tools/clippy/clippy_lints/src/needless_pass_by_ref_mut.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,7 @@ 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+
self.prev_move_to_closure.swap_remove(vid);
386386
}
387387
}
388388

src/tools/clippy/clippy_lints/src/no_effect.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ 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+
if let Some(span) = self.underscore_bindings.swap_remove(&hir_id) {
102102
span_lint_hir(
103103
cx,
104104
NO_EFFECT_UNDERSCORE_BINDING,
@@ -112,7 +112,7 @@ impl<'tcx> LateLintPass<'tcx> for NoEffect {
112112

113113
fn check_expr(&mut self, _: &LateContext<'tcx>, expr: &'tcx rustc_hir::Expr<'tcx>) {
114114
if let Some(def_id) = path_to_local(expr) {
115-
self.underscore_bindings.remove(&def_id);
115+
self.underscore_bindings.swap_remove(&def_id);
116116
}
117117
}
118118
}

src/tools/clippy/clippy_lints/src/only_used_in_recursion.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ 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+
self.by_id.swap_remove(&id);
157157
}
158158
}
159159

0 commit comments

Comments
 (0)