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::{CtorOf, DefKind, Res};
|
||||||
use crate::def_id::DefId;
|
use crate::def_id::DefId;
|
||||||
use crate::hir::{self, HirId, PatKind};
|
use crate::hir::{self, HirId, PatKind};
|
||||||
|
use rustc_data_structures::stable_set::FxHashSet;
|
||||||
use rustc_span::symbol::Ident;
|
use rustc_span::symbol::Ident;
|
||||||
use rustc_span::Span;
|
use rustc_span::Span;
|
||||||
|
|
||||||
|
@ -138,8 +139,10 @@ impl hir::Pat<'_> {
|
||||||
}
|
}
|
||||||
_ => true,
|
_ => true,
|
||||||
});
|
});
|
||||||
variants.sort();
|
// We remove duplicates by inserting into a `FxHashSet` to avoid re-ordering
|
||||||
variants.dedup();
|
// the bounds
|
||||||
|
let mut duplicates = FxHashSet::default();
|
||||||
|
variants.retain(|def_id| duplicates.insert(*def_id));
|
||||||
variants
|
variants
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue