1
Fork 0

Remove String allocation in loop

This commit is contained in:
Roc Yu 2021-12-25 19:41:19 -05:00
parent 51e8031e14
commit 141c542052
No known key found for this signature in database
GPG key ID: 5068CE514A79D27F

View file

@ -141,9 +141,7 @@ crate fn print_generic_bounds<'a, 'tcx: 'a>(
display_fn(move |f| {
let mut bounds_dup = FxHashSet::default();
for (i, bound) in
bounds.iter().filter(|b| bounds_dup.insert(b.print(cx).to_string())).enumerate()
{
for (i, bound) in bounds.iter().filter(|b| bounds_dup.insert(b.clone())).enumerate() {
if i > 0 {
f.write_str(" + ")?;
}