Simplify creation of a set.

This commit is contained in:
Nicholas Nethercote 2024-08-28 08:24:20 +10:00
parent fda52b8f63
commit 2932e097f4

View File

@ -220,10 +220,8 @@ fn is_mir_available(tcx: TyCtxt<'_>, def_id: LocalDefId) -> bool {
/// Finds the full set of `DefId`s within the current crate that have /// Finds the full set of `DefId`s within the current crate that have
/// MIR associated with them. /// MIR associated with them.
fn mir_keys(tcx: TyCtxt<'_>, (): ()) -> FxIndexSet<LocalDefId> { fn mir_keys(tcx: TyCtxt<'_>, (): ()) -> FxIndexSet<LocalDefId> {
let mut set = FxIndexSet::default();
// All body-owners have MIR associated with them. // All body-owners have MIR associated with them.
set.extend(tcx.hir().body_owners()); let mut set: FxIndexSet<_> = tcx.hir().body_owners().collect();
// Additionally, tuple struct/variant constructors have MIR, but // Additionally, tuple struct/variant constructors have MIR, but
// they don't have a BodyId, so we need to build them separately. // they don't have a BodyId, so we need to build them separately.