Skip to content

Commit 143f784

Browse files
committed
replace_tabs -> normalize_whitespace
1 parent d68add9 commit 143f784

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

compiler/rustc_errors/src/emitter.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -730,7 +730,7 @@ impl EmitterWriter {
730730
}
731731

732732
let source_string = match file.get_line(line.line_index - 1) {
733-
Some(s) => replace_tabs(&*s),
733+
Some(s) => normalize_whitespace(&*s),
734734
None => return Vec::new(),
735735
};
736736

@@ -1286,7 +1286,7 @@ impl EmitterWriter {
12861286
}
12871287
for &(ref text, _) in msg.iter() {
12881288
// Account for newlines to align output to its label.
1289-
for (line, text) in replace_tabs(text).lines().enumerate() {
1289+
for (line, text) in normalize_whitespace(text).lines().enumerate() {
12901290
buffer.append(
12911291
0 + line,
12921292
&format!(
@@ -1550,7 +1550,7 @@ impl EmitterWriter {
15501550

15511551
self.draw_line(
15521552
&mut buffer,
1553-
&replace_tabs(&unannotated_line),
1553+
&normalize_whitespace(&unannotated_line),
15541554
annotated_file.lines[line_idx + 1].line_index - 1,
15551555
last_buffer_line_num,
15561556
width_offset,
@@ -1672,7 +1672,7 @@ impl EmitterWriter {
16721672
buffer.puts(
16731673
row_num - 1,
16741674
max_line_num_len + 3,
1675-
&replace_tabs(
1675+
&normalize_whitespace(
16761676
&*file_lines
16771677
.file
16781678
.get_line(file_lines.lines[line_pos].line_index)
@@ -1698,7 +1698,7 @@ impl EmitterWriter {
16981698
}
16991699

17001700
// print the suggestion
1701-
buffer.append(row_num, &replace_tabs(line), Style::NoStyle);
1701+
buffer.append(row_num, &normalize_whitespace(line), Style::NoStyle);
17021702

17031703
// Colorize addition/replacements with green.
17041704
for &SubstitutionHighlight { start, end } in highlight_parts {
@@ -2093,7 +2093,7 @@ const OUTPUT_REPLACEMENTS: &[(char, &str)] = &[
20932093
('\u{2069}', ""),
20942094
];
20952095

2096-
fn replace_tabs(str: &str) -> String {
2096+
fn normalize_whitespace(str: &str) -> String {
20972097
let mut s = str.to_string();
20982098
for (c, replacement) in OUTPUT_REPLACEMENTS {
20992099
s = s.replace(*c, replacement);

0 commit comments

Comments
 (0)