Avoid sorting by DefId for necessary_variants()
This commit is contained in:
parent
8cd7d86ce2
commit
a0957c9d26
1 changed files with 5 additions and 2 deletions
|
@ -1,6 +1,7 @@
|
|||
use crate::def::{CtorOf, DefKind, Res};
|
||||
use crate::def_id::DefId;
|
||||
use crate::hir::{self, HirId, PatKind};
|
||||
use rustc_data_structures::stable_set::FxHashSet;
|
||||
use rustc_span::symbol::Ident;
|
||||
use rustc_span::Span;
|
||||
|
||||
|
@ -138,8 +139,10 @@ impl hir::Pat<'_> {
|
|||
}
|
||||
_ => true,
|
||||
});
|
||||
variants.sort();
|
||||
variants.dedup();
|
||||
// We remove duplicates by inserting into a `FxHashSet` to avoid re-ordering
|
||||
// the bounds
|
||||
let mut duplicates = FxHashSet::default();
|
||||
variants.retain(|def_id| duplicates.insert(*def_id));
|
||||
variants
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue