Size the deduped set appropriately.

Avoids lots of resizing as the set fills up.
This commit is contained in:
Nicholas Nethercote 2023-08-08 14:24:29 +10:00
parent 1c583c0b91
commit 3c99b3dbd0

View File

@ -1229,7 +1229,7 @@ fn opt_normalize_projection_type<'a, 'b, 'tcx>(
Normalized { value: projected_term, obligations: projected_obligations }
};
let mut deduped: SsoHashSet<_> = Default::default();
let mut deduped = SsoHashSet::with_capacity(projected_obligations.len());
result.obligations.retain(|obligation| deduped.insert(obligation.clone()));
if use_cache {