Skip to content

Commit 2b5cbb2

Browse files
committed
replace_tabs -> normalize_whitespace
1 parent aaa5c4e commit 2b5cbb2

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
@@ -721,7 +721,7 @@ impl EmitterWriter {
721721
}
722722

723723
let source_string = match file.get_line(line.line_index - 1) {
724-
Some(s) => replace_tabs(&*s),
724+
Some(s) => normalize_whitespace(&*s),
725725
None => return Vec::new(),
726726
};
727727

@@ -1272,7 +1272,7 @@ impl EmitterWriter {
12721272
buffer.append(0, ": ", header_style);
12731273
}
12741274
for &(ref text, _) in msg.iter() {
1275-
buffer.append(0, &replace_tabs(text), header_style);
1275+
buffer.append(0, &normalize_whitespace(text), header_style);
12761276
}
12771277
}
12781278

@@ -1526,7 +1526,7 @@ impl EmitterWriter {
15261526

15271527
self.draw_line(
15281528
&mut buffer,
1529-
&replace_tabs(&unannotated_line),
1529+
&normalize_whitespace(&unannotated_line),
15301530
annotated_file.lines[line_idx + 1].line_index - 1,
15311531
last_buffer_line_num,
15321532
width_offset,
@@ -1648,7 +1648,7 @@ impl EmitterWriter {
16481648
buffer.puts(
16491649
row_num - 1,
16501650
max_line_num_len + 3,
1651-
&replace_tabs(
1651+
&normalize_whitespace(
16521652
&*file_lines
16531653
.file
16541654
.get_line(file_lines.lines[line_pos].line_index)
@@ -1674,7 +1674,7 @@ impl EmitterWriter {
16741674
}
16751675

16761676
// print the suggestion
1677-
buffer.append(row_num, &replace_tabs(line), Style::NoStyle);
1677+
buffer.append(row_num, &normalize_whitespace(line), Style::NoStyle);
16781678

16791679
// Colorize addition/replacements with green.
16801680
for &SubstitutionHighlight { start, end } in highlight_parts {
@@ -2059,7 +2059,7 @@ const REPLACEMENTS: &[(char, &str)] = &[
20592059
('\u{200D}', ""), // Replace ZWJ with nothing for consistent terminal output of grapheme clusters.
20602060
];
20612061

2062-
fn replace_tabs(str: &str) -> String {
2062+
fn normalize_whitespace(str: &str) -> String {
20632063
let mut output = str.to_string();
20642064
for (c, replacement) in REPLACEMENTS {
20652065
output = output.replace(*c, replacement);

0 commit comments

Comments
 (0)