From f5229916e350e5b70a6db4f3378f63993eaecb3d Mon Sep 17 00:00:00 2001 From: klensy Date: Fri, 16 Apr 2021 03:20:07 +0300 Subject: added default for StyledChar --- compiler/rustc_errors/src/styled_buffer.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'compiler/rustc_errors') 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); -- cgit 1.4.1-3-g733a5