diff --git a/src/librustdoc/html/render/write_shared.rs b/src/librustdoc/html/render/write_shared.rs
index fb2b45802a67..09b2b01486ec 100644
--- a/src/librustdoc/html/render/write_shared.rs
+++ b/src/librustdoc/html/render/write_shared.rs
@@ -439,12 +439,8 @@ impl CratesIndexPart {
let content =
format!("
List of all crates
");
let template = layout::render(layout, &page, "", content, style_files);
- match SortedTemplate::from_template(&template, DELIMITER) {
- Ok(template) => template,
- Err(e) => panic!(
- "Object Replacement Character (U+FFFC) should not appear in the --index-page: {e}"
- ),
- }
+ SortedTemplate::from_template(&template, DELIMITER)
+ .expect("Object Replacement Character (U+FFFC) should not appear in the --index-page")
}
/// Might return parts that are duplicate with ones in prexisting index.html