mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-24 21:05:12 +00:00
Auto merge of #92269 - vacuus:clean-generics-print, r=camelid
rustdoc: Remove `collect` call in `clean::Generics::print`
This commit is contained in:
commit
7ae5508426
@ -222,15 +222,16 @@ impl clean::Generics {
|
|||||||
cx: &'a Context<'tcx>,
|
cx: &'a Context<'tcx>,
|
||||||
) -> impl fmt::Display + 'a + Captures<'tcx> {
|
) -> impl fmt::Display + 'a + Captures<'tcx> {
|
||||||
display_fn(move |f| {
|
display_fn(move |f| {
|
||||||
let real_params =
|
let mut real_params =
|
||||||
self.params.iter().filter(|p| !p.is_synthetic_type_param()).collect::<Vec<_>>();
|
self.params.iter().filter(|p| !p.is_synthetic_type_param()).peekable();
|
||||||
if real_params.is_empty() {
|
if real_params.peek().is_none() {
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
|
|
||||||
if f.alternate() {
|
if f.alternate() {
|
||||||
write!(f, "<{:#}>", comma_sep(real_params.iter().map(|g| g.print(cx))))
|
write!(f, "<{:#}>", comma_sep(real_params.map(|g| g.print(cx))))
|
||||||
} else {
|
} else {
|
||||||
write!(f, "<{}>", comma_sep(real_params.iter().map(|g| g.print(cx))))
|
write!(f, "<{}>", comma_sep(real_params.map(|g| g.print(cx))))
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user