Skip to content

Commit 61bc38e

Browse files
authored
Fix errors
1 parent e5db5b3 commit 61bc38e

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

src/librustc_errors/emitter.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -949,9 +949,9 @@ impl EmitterWriter {
949949
// | | |
950950
// | | something about `foo`
951951
// | something about `fn foo()`
952-
annotations_position.sort_by_key(|x| {
953-
// Decreasing order. When `a` and `b` are the same length, prefer `Primary`.
954-
(Reverse(a.1.len()), a.1.is_primary)
952+
annotations_position.sort_by_key(|(_, ann)| {
953+
// Decreasing order. When annotations share the same length, prefer `Primary`.
954+
(Reverse(ann.len()), ann.is_primary)
955955
});
956956

957957
// Write the underlines.
@@ -1006,14 +1006,14 @@ impl EmitterWriter {
10061006
for primary_span in msp.primary_spans() {
10071007
if !primary_span.is_dummy() {
10081008
let hi = sm.lookup_char_pos(primary_span.hi());
1009-
max = max(max, hi.line);
1009+
max = (hi.line).max(max);
10101010
}
10111011
}
10121012
if !self.short_message {
10131013
for span_label in msp.span_labels() {
10141014
if !span_label.span.is_dummy() {
10151015
let hi = sm.lookup_char_pos(span_label.span.hi());
1016-
max = max(max, hi.line);
1016+
max = (hi.line).max(max);
10171017
}
10181018
}
10191019
}
@@ -1057,9 +1057,9 @@ impl EmitterWriter {
10571057
let padding = " ".repeat(padding + label.len() + 5);
10581058

10591059
/// Returns `override` if it is present and `style` is `NoStyle` or `style` otherwise
1060-
fn style_or_override(style: Style, override: Option<Style>) -> Style {
1061-
match (style, override) {
1062-
(Style::NoStyle, Some(override)) => override,
1060+
fn style_or_override(style: Style, override_: Option<Style>) -> Style {
1061+
match (style, override_) {
1062+
(Style::NoStyle, Some(override_)) => override_,
10631063
_ => style,
10641064
}
10651065
}
@@ -1297,7 +1297,7 @@ impl EmitterWriter {
12971297
for line in &annotated_file.lines {
12981298
max_line_len = max(max_line_len, annotated_file.file
12991299
.get_line(line.line_index - 1)
1300-
.map_or(0, |s| s.len());
1300+
.map_or(0, |s| s.len()));
13011301
for ann in &line.annotations {
13021302
span_right_margin = max(span_right_margin, ann.start_col);
13031303
span_right_margin = max(span_right_margin, ann.end_col);
@@ -1525,7 +1525,7 @@ impl EmitterWriter {
15251525

15261526
// length of the code after substitution
15271527
let full_sub_len = part.snippet.chars()
1528-
.map(|ch| acc + unicode_width::UnicodeWidthChar::width(ch).unwrap_or(1))
1528+
.map(|ch| unicode_width::UnicodeWidthChar::width(ch).unwrap_or(1))
15291529
.sum() as isize;
15301530

15311531
// length of the code to be substituted

0 commit comments

Comments
 (0)