X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=src%2Flibrustc_errors%2Fstyled_buffer.rs;h=f2d255d7d952486b0ba986fd8ac255b31fdd7f44;hb=16469a123e45b15b5e520ad59aae6b9a840f71bb;hp=b12ab9e4576025c8efb7d17777df90fe7e94458b;hpb=f2dc3467f4ac64f2c5bfa999c52173bdd5e2f111;p=rust.git diff --git a/src/librustc_errors/styled_buffer.rs b/src/librustc_errors/styled_buffer.rs index b12ab9e4576..f2d255d7d95 100644 --- a/src/librustc_errors/styled_buffer.rs +++ b/src/librustc_errors/styled_buffer.rs @@ -10,10 +10,7 @@ pub struct StyledBuffer { impl StyledBuffer { pub fn new() -> StyledBuffer { - StyledBuffer { - text: vec![], - styles: vec![], - } + StyledBuffer { text: vec![], styles: vec![] } } fn replace_tabs(&mut self) { @@ -51,10 +48,7 @@ pub fn render(&mut self) -> Vec> { for (&c, &s) in row.iter().zip(row_style) { if s != current_style { if !current_text.is_empty() { - styled_vec.push(StyledString { - text: current_text, - style: current_style, - }); + styled_vec.push(StyledString { text: current_text, style: current_style }); } current_style = s; current_text = String::new(); @@ -62,10 +56,7 @@ pub fn render(&mut self) -> Vec> { current_text.push(c); } if !current_text.is_empty() { - styled_vec.push(StyledString { - text: current_text, - style: current_style, - }); + styled_vec.push(StyledString { text: current_text, style: current_style }); } // We're done with the row, push and keep going @@ -135,12 +126,14 @@ pub fn num_lines(&self) -> usize { self.text.len() } - pub fn set_style_range(&mut self, - line: usize, - col_start: usize, - col_end: usize, - style: Style, - overwrite: bool) { + pub fn set_style_range( + &mut self, + line: usize, + col_start: usize, + col_end: usize, + style: Style, + overwrite: bool, + ) { for col in col_start..col_end { self.set_style(line, col, style, overwrite); }