\
"
- )
- .unwrap();
+ )?;
// Only generate inline code for MAX_FULL_EXAMPLES number of examples. Otherwise we could
// make the page arbitrarily huge!
@@ -2774,9 +2777,8 @@ fn render_call_locations
(mut w: W, cx: &Context<'_>, item: &clean
if it.peek().is_some() {
w.write_str(
r#"Additional examples can be found in:
"#,
- )
- .unwrap();
- it.for_each(|(_, call_data)| {
+ )?;
+ it.try_for_each(|(_, call_data)| {
let (url, _) = link_to_loc(call_data, &call_data.locations[0]);
write!(
w,
@@ -2784,13 +2786,12 @@ fn render_call_locations(mut w: W, cx: &Context<'_>, item: &clean
url = url,
name = call_data.display_name
)
- .unwrap();
- });
- w.write_str("
").unwrap();
+ })?;
+ w.write_str(" ")?;
}
- w.write_str("").unwrap();
+ w.write_str("")?;
}
- w.write_str("").unwrap();
+ w.write_str("")
}
diff --git a/src/librustdoc/html/render/sidebar.rs b/src/librustdoc/html/render/sidebar.rs
index cd0c9775f5c97..a9029972d9630 100644
--- a/src/librustdoc/html/render/sidebar.rs
+++ b/src/librustdoc/html/render/sidebar.rs
@@ -1,5 +1,6 @@
use std::borrow::Cow;
use std::cmp::Ordering;
+use std::fmt;
use askama::Template;
use rustc_data_structures::fx::FxHashSet;
@@ -135,7 +136,11 @@ pub(crate) mod filters {
}
}
-pub(super) fn print_sidebar(cx: &Context<'_>, it: &clean::Item, buffer: &mut String) {
+pub(super) fn print_sidebar(
+ cx: &Context<'_>,
+ it: &clean::Item,
+ mut buffer: impl fmt::Write,
+) -> fmt::Result {
let mut ids = IdMap::new();
let mut blocks: Vec