diff options
| author | Esteban Kuber <esteban@kuber.com.ar> | 2021-09-10 07:32:07 +0000 |
|---|---|---|
| committer | Esteban Kuber <esteban@kuber.com.ar> | 2021-11-23 20:37:21 +0000 |
| commit | 143f78419934b63313ca8a4dd8e55e9ff5f858bb (patch) | |
| tree | 1d0e5c3d4563bf7585d5d3c7f41c1dbc4040d6f9 /compiler/rustc_errors | |
| parent | d68add9eccf2561380177d07d4e7b31433562a2b (diff) | |
| download | rust-143f78419934b63313ca8a4dd8e55e9ff5f858bb.tar.gz rust-143f78419934b63313ca8a4dd8e55e9ff5f858bb.zip | |
`replace_tabs` -> `normalize_whitespace`
Diffstat (limited to 'compiler/rustc_errors')
| -rw-r--r-- | compiler/rustc_errors/src/emitter.rs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/compiler/rustc_errors/src/emitter.rs b/compiler/rustc_errors/src/emitter.rs index d44a216f234..d64a589bd9b 100644 --- a/compiler/rustc_errors/src/emitter.rs +++ b/compiler/rustc_errors/src/emitter.rs @@ -730,7 +730,7 @@ impl EmitterWriter { } let source_string = match file.get_line(line.line_index - 1) { - Some(s) => replace_tabs(&*s), + Some(s) => normalize_whitespace(&*s), None => return Vec::new(), }; @@ -1286,7 +1286,7 @@ impl EmitterWriter { } for &(ref text, _) in msg.iter() { // Account for newlines to align output to its label. - for (line, text) in replace_tabs(text).lines().enumerate() { + for (line, text) in normalize_whitespace(text).lines().enumerate() { buffer.append( 0 + line, &format!( @@ -1550,7 +1550,7 @@ impl EmitterWriter { self.draw_line( &mut buffer, - &replace_tabs(&unannotated_line), + &normalize_whitespace(&unannotated_line), annotated_file.lines[line_idx + 1].line_index - 1, last_buffer_line_num, width_offset, @@ -1672,7 +1672,7 @@ impl EmitterWriter { buffer.puts( row_num - 1, max_line_num_len + 3, - &replace_tabs( + &normalize_whitespace( &*file_lines .file .get_line(file_lines.lines[line_pos].line_index) @@ -1698,7 +1698,7 @@ impl EmitterWriter { } // print the suggestion - buffer.append(row_num, &replace_tabs(line), Style::NoStyle); + buffer.append(row_num, &normalize_whitespace(line), Style::NoStyle); // Colorize addition/replacements with green. for &SubstitutionHighlight { start, end } in highlight_parts { @@ -2093,7 +2093,7 @@ const OUTPUT_REPLACEMENTS: &[(char, &str)] = &[ ('\u{2069}', ""), ]; -fn replace_tabs(str: &str) -> String { +fn normalize_whitespace(str: &str) -> String { let mut s = str.to_string(); for (c, replacement) in OUTPUT_REPLACEMENTS { s = s.replace(*c, replacement); |
