about summary refs log tree commit diff
diff options
context:
space:
mode:
authorNoah Lev <camelidcamel@gmail.com>2021-08-21 17:24:49 -0700
committerNoah Lev <camelidcamel@gmail.com>2021-08-21 17:24:49 -0700
commitd18936a731fa1d2bf49073bd0f059129ef1b0ef1 (patch)
tree5f4aaac1cc2b95e22de724fc8179cf980ca08435
parent74147b86c50ebdaa7d8420fcbf82fa647a6db394 (diff)
downloadrust-d18936a731fa1d2bf49073bd0f059129ef1b0ef1.tar.gz
rust-d18936a731fa1d2bf49073bd0f059129ef1b0ef1.zip
Use `write!`
-rw-r--r--src/librustdoc/html/length_limit.rs8
1 files changed, 2 insertions, 6 deletions
diff --git a/src/librustdoc/html/length_limit.rs b/src/librustdoc/html/length_limit.rs
index cc4a7f37fe9..2b47033744f 100644
--- a/src/librustdoc/html/length_limit.rs
+++ b/src/librustdoc/html/length_limit.rs
@@ -79,17 +79,13 @@ impl HtmlWithLimit {
     /// Close the most recently opened HTML tag.
     pub(super) fn close_tag(&mut self) {
         let tag_name = self.unclosed_tags.pop().unwrap();
-        self.buf.push_str("</");
-        self.buf.push_str(tag_name);
-        self.buf.push('>');
+        write!(self.buf, "</{}>", tag_name).unwrap();
     }
 
     /// Write all queued tags and add them to the `unclosed_tags` list.
     fn flush_queue(&mut self) {
         for tag_name in self.queued_tags.drain(..) {
-            self.buf.push('<');
-            self.buf.push_str(tag_name);
-            self.buf.push('>');
+            write!(self.buf, "<{}>", tag_name).unwrap();
 
             self.unclosed_tags.push(tag_name);
         }