Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions src/librustdoc/html/format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ use super::url_parts_builder::{UrlPartsBuilder, estimate_item_path_byte_length};
use crate::clean::types::ExternalLocation;
use crate::clean::utils::find_nearest_parent_module;
use crate::clean::{self, ExternalCrate, PrimitiveType};
use crate::display::Joined as _;
use crate::display::{Joined as _, MaybeDisplay as _};
use crate::formats::cache::Cache;
use crate::formats::item_type::ItemType;
use crate::html::escape::{Escape, EscapeBodyText};
Expand Down Expand Up @@ -178,12 +178,12 @@ pub(crate) fn print_where_clause<'a, 'tcx: 'a>(
cx: &'a Context<'tcx>,
indent: usize,
ending: Ending,
) -> impl Display + 'a + Captures<'tcx> {
fmt::from_fn(move |f| {
if gens.where_predicates.is_empty() {
return Ok(());
}
) -> Option<impl Display + 'a + Captures<'tcx>> {
if gens.where_predicates.is_empty() {
return None;
}

Some(fmt::from_fn(move |f| {
let where_preds = fmt::from_fn(|f| {
gens.where_predicates
.iter()
Expand Down Expand Up @@ -246,7 +246,7 @@ pub(crate) fn print_where_clause<'a, 'tcx: 'a>(
}
};
write!(f, "{clause}")
})
}))
}

impl clean::Lifetime {
Expand Down Expand Up @@ -1179,7 +1179,7 @@ impl clean::Impl {
self.print_type(&self.for_, f, use_absolute, cx)?;
}

print_where_clause(&self.generics, cx, 0, Ending::Newline).fmt(f)
print_where_clause(&self.generics, cx, 0, Ending::Newline).maybe_display().fmt(f)
})
}
fn print_type<'a, 'tcx: 'a>(
Expand Down
5 changes: 2 additions & 3 deletions src/librustdoc/html/render/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -237,8 +237,7 @@ impl<'tcx> Context<'tcx> {
};

if !render_redirect_pages {
let mut page_buffer = String::new();
print_item(self, it, &mut page_buffer);
let content = print_item(self, it);
let page = layout::Page {
css_class: tyname_s,
root_path: &self.root_path(),
Expand All @@ -254,7 +253,7 @@ impl<'tcx> Context<'tcx> {
BufDisplay(|buf: &mut String| {
print_sidebar(self, it, buf);
}),
page_buffer,
content,
&self.shared.style_files,
)
} else {
Expand Down
Loading
Loading