about summary refs log tree commit diff
diff options
context:
space:
mode:
authorYotam Ofek <yotam.ofek@gmail.com>2025-05-24 11:56:41 +0000
committerYotam Ofek <yotam.ofek@gmail.com>2025-06-18 09:42:43 +0000
commitb2fe858a4e69e51e97d737496e938589b26db709 (patch)
treeaa8ce3088b8bff39986d156d7ac35a965fde4e9c
parent27733d46d79f4eb92e240fbba502c43022665735 (diff)
downloadrust-b2fe858a4e69e51e97d737496e938589b26db709.tar.gz
rust-b2fe858a4e69e51e97d737496e938589b26db709.zip
`Result::expect` instead of `match` and `panic!`
-rw-r--r--src/librustdoc/html/render/write_shared.rs8
1 files changed, 2 insertions, 6 deletions
diff --git a/src/librustdoc/html/render/write_shared.rs b/src/librustdoc/html/render/write_shared.rs
index fb2b45802a6..09b2b01486e 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!("<h1>List of all crates</h1><ul class=\"all-items\">{DELIMITER}</ul>");
         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