Skip to content

Commit 7ae5508

Browse files
committed
Auto merge of #92269 - vacuus:clean-generics-print, r=camelid
rustdoc: Remove `collect` call in `clean::Generics::print`
2 parents 83b15bf + bbbeefd commit 7ae5508

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

Diff for: src/librustdoc/html/format.rs

+6-5
Original file line numberDiff line numberDiff line change
@@ -222,15 +222,16 @@ impl clean::Generics {
222222
cx: &'a Context<'tcx>,
223223
) -> impl fmt::Display + 'a + Captures<'tcx> {
224224
display_fn(move |f| {
225-
let real_params =
226-
self.params.iter().filter(|p| !p.is_synthetic_type_param()).collect::<Vec<_>>();
227-
if real_params.is_empty() {
225+
let mut real_params =
226+
self.params.iter().filter(|p| !p.is_synthetic_type_param()).peekable();
227+
if real_params.peek().is_none() {
228228
return Ok(());
229229
}
230+
230231
if f.alternate() {
231-
write!(f, "<{:#}>", comma_sep(real_params.iter().map(|g| g.print(cx))))
232+
write!(f, "<{:#}>", comma_sep(real_params.map(|g| g.print(cx))))
232233
} else {
233-
write!(f, "&lt;{}&gt;", comma_sep(real_params.iter().map(|g| g.print(cx))))
234+
write!(f, "&lt;{}&gt;", comma_sep(real_params.map(|g| g.print(cx))))
234235
}
235236
})
236237
}

0 commit comments

Comments
 (0)