Don't emit empty notes
This commit is contained in:
parent
063b1675b2
commit
2e2a4797a2
@ -1431,25 +1431,27 @@ impl EmitterWriter {
|
||||
};
|
||||
for (i, annotation) in annotations.into_iter().enumerate() {
|
||||
if let Some(label) = &annotation.label {
|
||||
let style = if annotation.is_primary {
|
||||
Style::LabelPrimary
|
||||
} else {
|
||||
Style::LabelSecondary
|
||||
};
|
||||
if annotation_id == 0 {
|
||||
buffer.prepend(line_idx, " |", Style::LineNumber);
|
||||
for _ in 0..max_line_num_len {
|
||||
buffer.prepend(line_idx, " ", Style::NoStyle);
|
||||
if !label.is_empty() {
|
||||
let style = if annotation.is_primary {
|
||||
Style::LabelPrimary
|
||||
} else {
|
||||
Style::LabelSecondary
|
||||
};
|
||||
if annotation_id == 0 {
|
||||
buffer.prepend(line_idx, " |", Style::LineNumber);
|
||||
for _ in 0..max_line_num_len {
|
||||
buffer.prepend(line_idx, " ", Style::NoStyle);
|
||||
}
|
||||
line_idx += 1;
|
||||
buffer.append(line_idx + i, " = note: ", style);
|
||||
for _ in 0..max_line_num_len {
|
||||
buffer.prepend(line_idx, " ", Style::NoStyle);
|
||||
}
|
||||
} else {
|
||||
buffer.append(line_idx + i, ": ", style);
|
||||
}
|
||||
line_idx += 1;
|
||||
buffer.append(line_idx + i, " = note: ", style);
|
||||
for _ in 0..max_line_num_len {
|
||||
buffer.prepend(line_idx, " ", Style::NoStyle);
|
||||
}
|
||||
} else {
|
||||
buffer.append(line_idx + i, ": ", style);
|
||||
buffer.append(line_idx + i, label, style);
|
||||
}
|
||||
buffer.append(line_idx + i, label, style);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -6,8 +6,6 @@ LL | match x { }
|
||||
|
|
||||
note: `Option<i32>` defined here
|
||||
--> $SRC_DIR/core/src/option.rs:LL:COL
|
||||
|
|
||||
= note:
|
||||
$SRC_DIR/core/src/option.rs:LL:COL: not covered
|
||||
$SRC_DIR/core/src/option.rs:LL:COL: not covered
|
||||
= note: the matched value is of type `Option<i32>`
|
||||
|
@ -8,8 +8,6 @@ LL | let Some(y) = x;
|
||||
= note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html
|
||||
note: `Option<i32>` defined here
|
||||
--> $SRC_DIR/core/src/option.rs:LL:COL
|
||||
|
|
||||
= note:
|
||||
$SRC_DIR/core/src/option.rs:LL:COL: not covered
|
||||
= note: the matched value is of type `Option<i32>`
|
||||
help: you might want to use `if let` to ignore the variant that isn't matched
|
||||
|
@ -6,8 +6,6 @@ LL | for Some(x) in xs {}
|
||||
|
|
||||
note: `Option<i32>` defined here
|
||||
--> $SRC_DIR/core/src/option.rs:LL:COL
|
||||
|
|
||||
= note:
|
||||
$SRC_DIR/core/src/option.rs:LL:COL: not covered
|
||||
= note: the matched value is of type `Option<i32>`
|
||||
|
||||
|
@ -8,8 +8,6 @@ LL | let Ok(_x) = foo();
|
||||
= note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html
|
||||
note: `Result<u32, !>` defined here
|
||||
--> $SRC_DIR/core/src/result.rs:LL:COL
|
||||
|
|
||||
= note:
|
||||
$SRC_DIR/core/src/result.rs:LL:COL: not covered
|
||||
= note: the matched value is of type `Result<u32, !>`
|
||||
help: you might want to use `if let` to ignore the variant that isn't matched
|
||||
|
@ -6,8 +6,6 @@ LL | match Some(1) {
|
||||
|
|
||||
note: `Option<i32>` defined here
|
||||
--> $SRC_DIR/core/src/option.rs:LL:COL
|
||||
|
|
||||
= note:
|
||||
$SRC_DIR/core/src/option.rs:LL:COL: not covered
|
||||
= note: the matched value is of type `Option<i32>`
|
||||
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
||||
|
@ -66,8 +66,6 @@ LL | match None {
|
||||
|
|
||||
note: `Option<HiddenEnum>` defined here
|
||||
--> $SRC_DIR/core/src/option.rs:LL:COL
|
||||
|
|
||||
= note:
|
||||
$SRC_DIR/core/src/option.rs:LL:COL: not covered
|
||||
= note: the matched value is of type `Option<HiddenEnum>`
|
||||
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms
|
||||
|
@ -107,8 +107,6 @@ LL | match Some(A) {
|
||||
|
|
||||
note: `Option<Enum>` defined here
|
||||
--> $SRC_DIR/core/src/option.rs:LL:COL
|
||||
|
|
||||
= note:
|
||||
= note: the matched value is of type `Option<Enum>`
|
||||
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown, or multiple match arms
|
||||
|
|
||||
|
@ -8,7 +8,7 @@ note: `Box<ElementKind>` defined here
|
||||
--> $SRC_DIR/alloc/src/boxed.rs:LL:COL
|
||||
$SRC_DIR/alloc/src/boxed.rs:LL:COL
|
||||
$SRC_DIR/alloc/src/boxed.rs:LL:COL
|
||||
$SRC_DIR/alloc/src/boxed.rs:LL:COL:
|
||||
$SRC_DIR/alloc/src/boxed.rs:LL:COL
|
||||
= note: the matched value is of type `Box<ElementKind>`
|
||||
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
||||
|
|
||||
|
@ -19,8 +19,6 @@ LL | match Some(Some(North)) {
|
||||
|
|
||||
note: `Option<Option<Direction>>` defined here
|
||||
--> $SRC_DIR/core/src/option.rs:LL:COL
|
||||
|
|
||||
= note:
|
||||
$SRC_DIR/core/src/option.rs:LL:COL: not covered
|
||||
: not covered
|
||||
= note: the matched value is of type `Option<Option<Direction>>`
|
||||
|
@ -6,8 +6,6 @@ LL | match private::DATA {
|
||||
|
|
||||
note: `Option<Private>` defined here
|
||||
--> $SRC_DIR/core/src/option.rs:LL:COL
|
||||
|
|
||||
= note:
|
||||
$SRC_DIR/core/src/option.rs:LL:COL: not covered
|
||||
= note: the matched value is of type `Option<Private>`
|
||||
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
||||
|
@ -36,8 +36,6 @@ LL | match Some(10) {
|
||||
|
|
||||
note: `Option<i32>` defined here
|
||||
--> $SRC_DIR/core/src/option.rs:LL:COL
|
||||
|
|
||||
= note:
|
||||
$SRC_DIR/core/src/option.rs:LL:COL: not covered
|
||||
= note: the matched value is of type `Option<i32>`
|
||||
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
||||
|
@ -8,8 +8,6 @@ LL | let Ok(x) = res;
|
||||
= note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html
|
||||
note: `Result<u32, &R<'_>>` defined here
|
||||
--> $SRC_DIR/core/src/result.rs:LL:COL
|
||||
|
|
||||
= note:
|
||||
$SRC_DIR/core/src/result.rs:LL:COL: not covered
|
||||
= note: the matched value is of type `Result<u32, &R<'_>>`
|
||||
help: you might want to use `if let` to ignore the variant that isn't matched
|
||||
|
@ -6,8 +6,6 @@ LL | let _ = match x {
|
||||
|
|
||||
note: `Result<u32, &Void>` defined here
|
||||
--> $SRC_DIR/core/src/result.rs:LL:COL
|
||||
|
|
||||
= note:
|
||||
$SRC_DIR/core/src/result.rs:LL:COL: not covered
|
||||
= note: the matched value is of type `Result<u32, &Void>`
|
||||
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
||||
@ -85,8 +83,6 @@ LL | let _ = match x {
|
||||
|
|
||||
note: `Result<u32, Void>` defined here
|
||||
--> $SRC_DIR/core/src/result.rs:LL:COL
|
||||
|
|
||||
= note:
|
||||
$SRC_DIR/core/src/result.rs:LL:COL: not covered
|
||||
= note: the matched value is of type `Result<u32, Void>`
|
||||
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
||||
@ -105,8 +101,6 @@ LL | let Ok(x) = x;
|
||||
= note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html
|
||||
note: `Result<u32, Void>` defined here
|
||||
--> $SRC_DIR/core/src/result.rs:LL:COL
|
||||
|
|
||||
= note:
|
||||
$SRC_DIR/core/src/result.rs:LL:COL: not covered
|
||||
= note: the matched value is of type `Result<u32, Void>`
|
||||
help: you might want to use `if let` to ignore the variant that isn't matched
|
||||
|
Loading…
x
Reference in New Issue
Block a user