about summary refs log tree commit diff
path: root/src/librustdoc/formats/renderer.rs
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume.gomez@huawei.com>2023-11-18 22:56:13 +0100
committerGuillaume Gomez <guillaume.gomez@huawei.com>2023-11-18 23:05:30 +0100
commit1e55fc124382ab0fde9ac151b437bddb7b280554 (patch)
tree5f0c85c052127c9ac55adff6931fc8c8fda40d5b /src/librustdoc/formats/renderer.rs
parent28345f06d785213e6d37de5464c7070a4fc9ca67 (diff)
downloadrust-1e55fc124382ab0fde9ac151b437bddb7b280554.tar.gz
rust-1e55fc124382ab0fde9ac151b437bddb7b280554.zip
Remove unneeded `unknown` variable and `Symbol` creation when iterating over items in rustdoc rendering
Diffstat (limited to 'src/librustdoc/formats/renderer.rs')
-rw-r--r--src/librustdoc/formats/renderer.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/librustdoc/formats/renderer.rs b/src/librustdoc/formats/renderer.rs
index c49f1a4d37e..2535668b83f 100644
--- a/src/librustdoc/formats/renderer.rs
+++ b/src/librustdoc/formats/renderer.rs
@@ -1,5 +1,4 @@
 use rustc_middle::ty::TyCtxt;
-use rustc_span::Symbol;
 
 use crate::clean;
 use crate::config::RenderOptions;
@@ -68,7 +67,6 @@ pub(crate) fn run_format<'tcx, T: FormatRenderer<'tcx>>(
     // Render the crate documentation
     let mut work = vec![(format_renderer.make_child_renderer(), krate.module)];
 
-    let unknown = Symbol::intern("<unknown item>");
     while let Some((mut cx, item)) = work.pop() {
         if item.is_mod() && T::RUN_ON_MODULE {
             // modules are special because they add a namespace. We also need to
@@ -90,8 +88,10 @@ pub(crate) fn run_format<'tcx, T: FormatRenderer<'tcx>>(
             cx.mod_item_out()?;
         // FIXME: checking `item.name.is_some()` is very implicit and leads to lots of special
         // cases. Use an explicit match instead.
-        } else if item.name.is_some() && !item.is_extern_crate() {
-            prof.generic_activity_with_arg("render_item", item.name.unwrap_or(unknown).as_str())
+        } else if let Some(item_name) = item.name
+            && !item.is_extern_crate()
+        {
+            prof.generic_activity_with_arg("render_item", item_name.as_str())
                 .run(|| cx.item(item))?;
         }
     }