Skip to content

Commit 90c047b

Browse files
Replace the FxHashMap with an FxIndexMap
1 parent c18cd77 commit 90c047b

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

src/librustdoc/html/render/print_item.rs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use std::iter;
55
use askama::Template;
66
use rustc_abi::VariantIdx;
77
use rustc_ast::join_path_syms;
8-
use rustc_data_structures::fx::{FxHashMap, FxIndexSet};
8+
use rustc_data_structures::fx::{FxHashMap, FxIndexMap, FxIndexSet};
99
use rustc_hir as hir;
1010
use rustc_hir::def::CtorKind;
1111
use rustc_hir::def_id::DefId;
@@ -307,8 +307,8 @@ fn item_module(cx: &Context<'_>, item: &clean::Item, items: &[clean::Item]) -> i
307307
fmt::from_fn(|w| {
308308
write!(w, "{}", document(cx, item, None, HeadingOffset::H2))?;
309309

310-
let mut not_stripped_items: FxHashMap<ItemType, Vec<(usize, &clean::Item)>> =
311-
FxHashMap::default();
310+
let mut not_stripped_items: FxIndexMap<ItemType, Vec<(usize, &clean::Item)>> =
311+
FxIndexMap::default();
312312

313313
for (index, item) in items.iter().filter(|i| !i.is_stripped()).enumerate() {
314314
not_stripped_items.entry(item.type_()).or_default().push((index, item));
@@ -355,9 +355,7 @@ fn item_module(cx: &Context<'_>, item: &clean::Item, items: &[clean::Item]) -> i
355355
let tcx = cx.tcx();
356356

357357
match cx.shared.module_sorting {
358-
ModuleSorting::Alphabetical =>
359-
{
360-
#[allow(rustc::potential_query_instability)]
358+
ModuleSorting::Alphabetical => {
361359
for items in not_stripped_items.values_mut() {
362360
items.sort_by(|(_, i1), (_, i2)| cmp(i1, i2, tcx));
363361
}
@@ -383,7 +381,6 @@ fn item_module(cx: &Context<'_>, item: &clean::Item, items: &[clean::Item]) -> i
383381
// can be identical even if the elements are different (mostly in imports).
384382
// So in case this is an import, we keep everything by adding a "unique id"
385383
// (which is the position in the vector).
386-
#[allow(rustc::potential_query_instability)]
387384
for items in not_stripped_items.values_mut() {
388385
items.dedup_by_key(|(idx, i)| {
389386
(
@@ -397,7 +394,6 @@ fn item_module(cx: &Context<'_>, item: &clean::Item, items: &[clean::Item]) -> i
397394

398395
debug!("{not_stripped_items:?}");
399396

400-
#[allow(rustc::potential_query_instability)]
401397
let mut types = not_stripped_items.keys().copied().collect::<Vec<_>>();
402398
types.sort_unstable_by(|a, b| reorder(*a).cmp(&reorder(*b)));
403399

0 commit comments

Comments
 (0)