diff options
| author | Mark Rousskov <mark.simulacrum@gmail.com> | 2019-12-22 17:42:04 -0500 |
|---|---|---|
| committer | Mark Rousskov <mark.simulacrum@gmail.com> | 2019-12-22 17:42:47 -0500 |
| commit | a06baa56b95674fc626b3c3fd680d6a65357fe60 (patch) | |
| tree | cd9d867c2ca3cff5c1d6b3bd73377c44649fb075 /src/librustc_errors/styled_buffer.rs | |
| parent | 8eb7c58dbb7b32701af113bc58722d0d1fefb1eb (diff) | |
| download | rust-a06baa56b95674fc626b3c3fd680d6a65357fe60.tar.gz rust-a06baa56b95674fc626b3c3fd680d6a65357fe60.zip | |
Format the world
Diffstat (limited to 'src/librustc_errors/styled_buffer.rs')
| -rw-r--r-- | src/librustc_errors/styled_buffer.rs | 29 |
1 files changed, 11 insertions, 18 deletions
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 @@ impl StyledBuffer { 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 @@ impl StyledBuffer { 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 @@ impl StyledBuffer { 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); } |
