From 141c542052c1adec045136212a42f241ba3fb9a9 Mon Sep 17 00:00:00 2001 From: Roc Yu Date: Sat, 25 Dec 2021 19:41:19 -0500 Subject: [PATCH] Remove `String` allocation in loop --- src/librustdoc/html/format.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/librustdoc/html/format.rs b/src/librustdoc/html/format.rs index 3a2effa625cf3..7f21968f9d526 100644 --- a/src/librustdoc/html/format.rs +++ b/src/librustdoc/html/format.rs @@ -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(" + ")?; }