]> git.lizzy.rs Git - rust.git/blobdiff - src/librustdoc/html/toc.rs
Rollup merge of #105682 - thomcc:expose-ptr-fmt, r=RalfJung
[rust.git] / src / librustdoc / html / toc.rs
index 07e33052aa7c3540292e9da520181c16c0401b4b..a12c2a6a16c32f15ba951310a5af304f855bf3e0 100644 (file)
@@ -163,15 +163,18 @@ pub(crate) fn push(&mut self, level: u32, name: String, id: String) -> &str {
 
 impl Toc {
     fn print_inner(&self, v: &mut String) {
+        use std::fmt::Write as _;
+
         v.push_str("<ul>");
         for entry in &self.entries {
             // recursively format this table of contents
-            v.push_str(&format!(
+            let _ = write!(
+                v,
                 "\n<li><a href=\"#{id}\">{num} {name}</a>",
                 id = entry.id,
                 num = entry.sec_number,
                 name = entry.name
-            ));
+            );
             entry.children.print_inner(&mut *v);
             v.push_str("</li>");
         }