about summary refs log tree commit diff
path: root/compiler/rustc_errors/src
diff options
context:
space:
mode:
authorklensy <klensy@users.noreply.github.com>2021-04-16 03:20:07 +0300
committerklensy <klensy@users.noreply.github.com>2021-04-16 03:20:07 +0300
commitf5229916e350e5b70a6db4f3378f63993eaecb3d (patch)
tree9652bf4209c81c8e83124378a04ea19bc450cc7f /compiler/rustc_errors/src
parent756be4a052cf43d5dec2b7ee99e611d2127d989e (diff)
downloadrust-f5229916e350e5b70a6db4f3378f63993eaecb3d.tar.gz
rust-f5229916e350e5b70a6db4f3378f63993eaecb3d.zip
added default for StyledChar
Diffstat (limited to 'compiler/rustc_errors/src')
-rw-r--r--compiler/rustc_errors/src/styled_buffer.rs10
1 files changed, 8 insertions, 2 deletions
diff --git a/compiler/rustc_errors/src/styled_buffer.rs b/compiler/rustc_errors/src/styled_buffer.rs
index 89b8afdc7ab..8ce9c4bbfa1 100644
--- a/compiler/rustc_errors/src/styled_buffer.rs
+++ b/compiler/rustc_errors/src/styled_buffer.rs
@@ -19,6 +19,12 @@ impl StyledChar {
     }
 }
 
+impl Default for StyledChar {
+    fn default() -> Self {
+        StyledChar::new(' ', Style::NoStyle)
+    }
+}
+
 impl StyledBuffer {
     pub fn new() -> StyledBuffer {
         StyledBuffer { text: vec![] }
@@ -71,7 +77,7 @@ impl StyledBuffer {
         } else {
             let mut i = self.text[line].len();
             while i < col {
-                self.text[line].push(StyledChar::new(' ', Style::NoStyle));
+                self.text[line].push(StyledChar::default());
                 i += 1;
             }
             self.text[line].push(StyledChar::new(chr, style));
@@ -92,7 +98,7 @@ impl StyledBuffer {
 
         // Push the old content over to make room for new content
         for _ in 0..string_len {
-            self.text[line].insert(0, StyledChar::new(' ', Style::NoStyle));
+            self.text[line].insert(0, StyledChar::default());
         }
 
         self.puts(line, 0, string, style);