about summary refs log tree commit diff
path: root/src/librustdoc/html/toc.rs
diff options
context:
space:
mode:
authorMark Rousskov <mark.simulacrum@gmail.com>2019-12-22 17:42:04 -0500
committerMark Rousskov <mark.simulacrum@gmail.com>2019-12-22 17:42:47 -0500
commita06baa56b95674fc626b3c3fd680d6a65357fe60 (patch)
treecd9d867c2ca3cff5c1d6b3bd73377c44649fb075 /src/librustdoc/html/toc.rs
parent8eb7c58dbb7b32701af113bc58722d0d1fefb1eb (diff)
downloadrust-a06baa56b95674fc626b3c3fd680d6a65357fe60.tar.gz
rust-a06baa56b95674fc626b3c3fd680d6a65357fe60.zip
Format the world
Diffstat (limited to 'src/librustdoc/html/toc.rs')
-rw-r--r--src/librustdoc/html/toc.rs20
1 files changed, 11 insertions, 9 deletions
diff --git a/src/librustdoc/html/toc.rs b/src/librustdoc/html/toc.rs
index 0fb2f8dd796..034fb273000 100644
--- a/src/librustdoc/html/toc.rs
+++ b/src/librustdoc/html/toc.rs
@@ -16,7 +16,7 @@ pub struct Toc {
     /// ### A
     /// ## B
     /// ```
-    entries: Vec<TocEntry>
+    entries: Vec<TocEntry>,
 }
 
 impl Toc {
@@ -46,7 +46,7 @@ pub struct TocBuilder {
     /// it is the most recent one).
     ///
     /// We also have `chain[0].level <= top_level.entries[last]`.
-    chain: Vec<TocEntry>
+    chain: Vec<TocEntry>,
 }
 
 impl TocBuilder {
@@ -54,7 +54,6 @@ impl TocBuilder {
         TocBuilder { top_level: Toc { entries: Vec::new() }, chain: Vec::new() }
     }
 
-
     /// Converts into a true `Toc` struct.
     pub fn into_toc(mut self) -> Toc {
         // we know all levels are >= 1.
@@ -100,14 +99,14 @@ impl TocBuilder {
                         // this is the parent we want, so return it to
                         // its rightful place.
                         self.chain.push(next);
-                        return
+                        return;
                     } else {
                         this = Some(next);
                     }
                 }
                 None => {
                     this.map(|e| self.top_level.entries.push(e));
-                    return
+                    return;
                 }
             }
         }
@@ -152,7 +151,7 @@ impl TocBuilder {
             name,
             sec_number,
             id,
-            children: Toc { entries: Vec::new() }
+            children: Toc { entries: Vec::new() },
         });
 
         // get the thing we just pushed, so we can borrow the string
@@ -167,9 +166,12 @@ impl Toc {
         v.push_str("<ul>");
         for entry in &self.entries {
             // recursively format this table of contents
-            v.push_str(&format!("\n<li><a href=\"#{id}\">{num} {name}</a>",
-                   id = entry.id,
-                   num = entry.sec_number, name = entry.name));
+            v.push_str(&format!(
+                "\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>");
         }