We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
necessary_variants()
1 parent 8cd7d86 commit a0957c9Copy full SHA for a0957c9
compiler/rustc_hir/src/pat_util.rs
@@ -1,6 +1,7 @@
1
use crate::def::{CtorOf, DefKind, Res};
2
use crate::def_id::DefId;
3
use crate::hir::{self, HirId, PatKind};
4
+use rustc_data_structures::stable_set::FxHashSet;
5
use rustc_span::symbol::Ident;
6
use rustc_span::Span;
7
@@ -138,8 +139,10 @@ impl hir::Pat<'_> {
138
139
}
140
_ => true,
141
});
- variants.sort();
142
- variants.dedup();
+ // We remove duplicates by inserting into a `FxHashSet` to avoid re-ordering
143
+ // the bounds
144
+ let mut duplicates = FxHashSet::default();
145
+ variants.retain(|def_id| duplicates.insert(*def_id));
146
variants
147
148
0 commit comments