diff --git a/examples/custom_level.rs b/examples/custom_level.rs index 0cc79850..f05813a8 100644 --- a/examples/custom_level.rs +++ b/examples/custom_level.rs @@ -29,39 +29,38 @@ fn main() { } } "#; - let report = &[ - Group::with_title( - Level::ERROR - .primary_title("`break` with value from a `while` loop") - .id("E0571"), - ) - .element( - Snippet::source(source) - .line_start(1) - .path("$DIR/issue-114529-illegal-break-with-value.rs") - .annotation( - AnnotationKind::Primary - .span(483..581) - .label("can only break with a value inside `loop` or breakable block"), - ) - .annotation( - AnnotationKind::Context - .span(462..472) - .label("you can't `break` with a value in a `while` loop"), - ), - ), - Group::with_title( - Level::HELP - .with_name(Some("suggestion")) - .primary_title("use `break` on its own without a value inside this `while` loop"), - ) - .element( - Snippet::source(source) - .line_start(1) - .path("$DIR/issue-114529-illegal-break-with-value.rs") - .patch(Patch::new(483..581, "break")), - ), - ]; + let report = + &[ + Group::with_title( + Level::ERROR + .primary_title("`break` with value from a `while` loop") + .id("E0571"), + ) + .element( + Snippet::source(source) + .line_start(1) + .path("$DIR/issue-114529-illegal-break-with-value.rs") + .annotation( + AnnotationKind::Primary + .span(483..581) + .label("can only break with a value inside `loop` or breakable block"), + ) + .annotation( + AnnotationKind::Context + .span(462..472) + .label("you can't `break` with a value in a `while` loop"), + ), + ), + Group::with_title(Level::HELP.with_name(Some("suggestion")).secondary_title( + "use `break` on its own without a value inside this `while` loop", + )) + .element( + Snippet::source(source) + .line_start(1) + .path("$DIR/issue-114529-illegal-break-with-value.rs") + .patch(Patch::new(483..581, "break")), + ), + ]; let renderer = Renderer::styled().decor_style(DecorStyle::Unicode); anstream::println!("{}", renderer.render(report)); diff --git a/examples/footer.rs b/examples/footer.rs index a2b1ac35..1e208b5b 100644 --- a/examples/footer.rs +++ b/examples/footer.rs @@ -11,7 +11,7 @@ fn main() { "expected struct `annotate_snippets::snippet::Slice`, found reference", )), ), - Group::with_title(Level::NOTE.primary_title( + Group::with_title(Level::NOTE.secondary_title( "expected type: `snippet::Annotation`\n found type: `__&__snippet::Annotation`", )), ]; diff --git a/examples/highlight_message.rs b/examples/highlight_message.rs index baed3c8b..3f7107cd 100644 --- a/examples/highlight_message.rs +++ b/examples/highlight_message.rs @@ -50,7 +50,7 @@ fn main() { ), ) .element(Level::NOTE.message(&message)), - Group::with_title(Level::NOTE.primary_title("function defined here")).element( + Group::with_title(Level::NOTE.secondary_title("function defined here")).element( Snippet::source(source) .path("$DIR/highlighting.rs") .annotation(AnnotationKind::Context.span(200..333).label("")) diff --git a/tests/color/multiline_removal_suggestion.rs b/tests/color/multiline_removal_suggestion.rs index 4dcd61fe..ede35b4d 100644 --- a/tests/color/multiline_removal_suggestion.rs +++ b/tests/color/multiline_removal_suggestion.rs @@ -86,13 +86,13 @@ fn main() {} .element( Level::NOTE.message("required for `(bool, HashSet)` to implement `IntoIterator`"), ), - Group::with_title(Level::NOTE.primary_title("required by a bound in `flatten`")) + Group::with_title(Level::NOTE.secondary_title("required by a bound in `flatten`")) .element( Origin::path("/rustc/FAKE_PREFIX/library/core/src/iter/traits/iterator.rs") .line(1556) .char_column(4), ), - Group::with_title(Level::HELP.primary_title("consider removing this method call, as the receiver has type `std::vec::IntoIter>` and `std::vec::IntoIter>: Iterator` trivially holds")).element( + Group::with_title(Level::HELP.secondary_title("consider removing this method call, as the receiver has type `std::vec::IntoIter>` and `std::vec::IntoIter>: Iterator` trivially holds")).element( Snippet::source(source) .path("$DIR/multiline-removal-suggestion.rs") diff --git a/tests/formatter.rs b/tests/formatter.rs index e9fcd036..b08167bd 100644 --- a/tests/formatter.rs +++ b/tests/formatter.rs @@ -1049,7 +1049,7 @@ fn two_suggestions_same_span() { .element(Snippet::source(source).annotation(AnnotationKind::Primary.span(4..5))), Group::with_title( Level::HELP - .primary_title("you might have meant to use one of the following enum variants"), + .secondary_title("you might have meant to use one of the following enum variants"), ) .element(Snippet::source(source).patch(Patch::new(4..5, "(A::Tuple())"))) .element(Snippet::source(source).patch(Patch::new(4..5, "A::Unit"))), @@ -1112,7 +1112,7 @@ fn main() { .label("method not found in `Chaenomeles`"), ), ), - Group::with_title(Level::HELP.primary_title( + Group::with_title(Level::HELP.secondary_title( "the following traits which provide `pick` are implemented but not in scope; perhaps you want to import one of them", )) .element( @@ -1160,7 +1160,7 @@ fn single_line_non_overlapping_suggestions() { .line_start(1) .annotation(AnnotationKind::Primary.span(4..5)), ), - Group::with_title(Level::HELP.primary_title("make these changes and things will work")) + Group::with_title(Level::HELP.secondary_title("make these changes and things will work")) .element( Snippet::source(source) .patch(Patch::new(4..5, "(A::Tuple())")) @@ -1198,7 +1198,7 @@ fn single_line_non_overlapping_suggestions2() { .line_start(1) .annotation(AnnotationKind::Primary.span(4..18)), ), - Group::with_title(Level::HELP.primary_title("make these changes and things will work")) + Group::with_title(Level::HELP.secondary_title("make these changes and things will work")) .element( Snippet::source(source) .patch(Patch::new(4..18, "(A::Tuple())")) @@ -1266,7 +1266,7 @@ fn multiple_replacements() { ), Group::with_title( Level::HELP - .primary_title("try explicitly pass `&Self` into the Closure as an argument"), + .secondary_title("try explicitly pass `&Self` into the Closure as an argument"), ) .element( Snippet::source(source) @@ -1340,7 +1340,7 @@ fn main() { .label("first borrow later used here"), ), ), - Group::with_title(Level::HELP.primary_title( + Group::with_title(Level::HELP.secondary_title( "if you want to call `next` on a iterator within the loop, consider using `while let`", )) .element( @@ -1409,13 +1409,15 @@ fn main() {}"#; ), ), Group::with_title( - Level::HELP.primary_title("there is a crate or module with a similar name"), + Level::HELP.secondary_title("there is a crate or module with a similar name"), ) .element(Snippet::source(source).patch(Patch::new(122..124, "std"))), - Group::with_title(Level::HELP.primary_title("consider importing this module")) + Group::with_title(Level::HELP.secondary_title("consider importing this module")) .element(Snippet::source(source).patch(Patch::new(1..1, "use std::cell;\n"))), - Group::with_title(Level::HELP.primary_title("if you import `cell`, refer to it directly")) - .element(Snippet::source(source).patch(Patch::new(122..126, ""))), + Group::with_title( + Level::HELP.secondary_title("if you import `cell`, refer to it directly"), + ) + .element(Snippet::source(source).patch(Patch::new(122..126, ""))), ]; let expected = str![[r#" error[E0433]: failed to resolve: use of undeclared crate or module `st` @@ -1482,7 +1484,7 @@ fn main() {}"#; .label("this type parameter needs to be `Sized`"), ), ), - Group::with_title(Level::HELP.primary_title( + Group::with_title(Level::HELP.secondary_title( "consider removing the `?Sized` bound to make the type parameter `Sized`", )) .element(Snippet::source(source).patch(Patch::new(52..85, ""))), @@ -1543,7 +1545,7 @@ fn main() {}"#; )) ,Group::with_title( Level::NOTE - .primary_title("required by an implicit `Sized` bound in `Wrapper`") + .secondary_title("required by an implicit `Sized` bound in `Wrapper`") ).element( Snippet::source(source) .line_start(1) @@ -1556,7 +1558,7 @@ fn main() {}"#; ) ), Group::with_title( Level::HELP - .primary_title("you could relax the implicit `Sized` bound on `T` if it were used through indirection like `&T` or `Box`") + .secondary_title("you could relax the implicit `Sized` bound on `T` if it were used through indirection like `&T` or `Box`") ) .element( Snippet::source(source) @@ -1576,7 +1578,7 @@ fn main() {}"#; ),Group::with_title( Level::HELP - .primary_title("consider removing the `?Sized` bound to make the type parameter `Sized`") + .secondary_title("consider removing the `?Sized` bound to make the type parameter `Sized`") ).element( Snippet::source(source) @@ -1640,7 +1642,7 @@ zappy .id("E0277"), ), // We need an empty group here to ensure the HELP line is rendered correctly - Group::with_title(Level::HELP.primary_title( + Group::with_title(Level::HELP.secondary_title( "consider removing the `?Sized` bound to make the type parameter `Sized`", )) .element( @@ -1713,7 +1715,7 @@ fn main() { .span(208..510) .label("type mismatch resolving `, ...>>, ...> as Future>::Error == Foo`"), )),Group::with_title( - Level::NOTE.primary_title("expected this to be `Foo`") + Level::NOTE.secondary_title("expected this to be `Foo`") ).element( Snippet::source(source) .line_start(4) @@ -1799,7 +1801,7 @@ fn main() { .span(208..510) .label("type mismatch resolving `, ...>>, ...> as Future>::Error == Foo`"), )),Group::with_title( - Level::NOTE.primary_title("expected this to be `Foo`") + Level::NOTE.secondary_title("expected this to be `Foo`") ).element( Snippet::source(source) .line_start(4) @@ -2045,7 +2047,7 @@ fn main() { .message("expected fn pointer `for<'a> fn(Box<(dyn Any + Send + 'a)>) -> Pin<_>`\n found fn item `fn(Box<(dyn Any + Send + 'static)>) -> Pin<_> {wrapped_fn}`") , ),Group::with_title( - Level::NOTE.primary_title("function defined here"), + Level::NOTE.secondary_title("function defined here"), ).element( Snippet::source(source) .line_start(7) @@ -2322,7 +2324,7 @@ fn main() { Level::NOTE.message("string concatenation requires an owned `String` on the left"), ), Group::with_title( - Level::HELP.primary_title("create an owned `String` from a string reference"), + Level::HELP.secondary_title("create an owned `String` from a string reference"), ) .element( Snippet::source(source) @@ -2390,7 +2392,7 @@ fn foo() { .annotation(AnnotationKind::Primary.span(136..160)), ), - Group::with_title(Level::NOTE.primary_title("byte `193` is not valid utf-8")) + Group::with_title(Level::NOTE.secondary_title("byte `193` is not valid utf-8")) .element( Snippet::source(bin_source) .path("$DIR/not-utf8.bin") @@ -2581,7 +2583,7 @@ fn main() { Group::with_title( Level::HELP .with_name(Some("suggestion")) - .primary_title("use `break` on its own without a value inside this `while` loop") + .secondary_title("use `break` on its own without a value inside this `while` loop") .id("S0123"), ) .element( @@ -2725,7 +2727,8 @@ fn main() { .element(Level::NOTE.message(long_title2)) .element(Level::NOTE.message("`#[warn(array_into_iter)]` on by default")), Group::with_title( - Level::HELP.primary_title("use `.iter()` instead of `.into_iter()` to avoid ambiguity"), + Level::HELP + .secondary_title("use `.iter()` instead of `.into_iter()` to avoid ambiguity"), ) .element( Snippet::source(suggestion_source) @@ -2733,7 +2736,7 @@ fn main() { .line_start(3) .patch(Patch::new(10..19, "iter")), ), - Group::with_title(Level::HELP.primary_title(long_title3)).element( + Group::with_title(Level::HELP.secondary_title(long_title3)).element( Snippet::source(suggestion_source) .path("lint_example.rs") .line_start(3) @@ -2794,7 +2797,8 @@ fn main() { .element(Level::NOTE.message(long_title2)) .element(Level::NOTE.message("`#[warn(array_into_iter)]` on by default")), Group::with_title( - Level::HELP.primary_title("use `.iter()` instead of `.into_iter()` to avoid ambiguity"), + Level::HELP + .secondary_title("use `.iter()` instead of `.into_iter()` to avoid ambiguity"), ) .element( Snippet::source(suggestion_source) @@ -2802,7 +2806,7 @@ fn main() { .line_start(3) .patch(Patch::new(10..19, "iter")), ), - Group::with_title(Level::HELP.primary_title(long_title3)).element( + Group::with_title(Level::HELP.secondary_title(long_title3)).element( Snippet::source(suggestion_source) .path("lint_example.rs") .line_start(3) @@ -2979,7 +2983,7 @@ fn main() {} )), ) .element(Padding), - Group::with_title(Level::HELP.primary_title("consider specifying the generic argument")) + Group::with_title(Level::HELP.secondary_title("consider specifying the generic argument")) .element( Snippet::source(source) .path("$DIR/issue-42234-unknown-receiver-type.rs") @@ -3055,7 +3059,7 @@ fn main() {} "cannot infer type of the type parameter `S` declared on the method `sum`", )), ), - Group::with_title(Level::HELP.primary_title("consider specifying the generic argument")) + Group::with_title(Level::HELP.secondary_title("consider specifying the generic argument")) .element( Snippet::source(source) .path("$DIR/issue-42234-unknown-receiver-type.rs") diff --git a/tests/rustc_tests.rs b/tests/rustc_tests.rs index b52a864e..269eb3cc 100644 --- a/tests/rustc_tests.rs +++ b/tests/rustc_tests.rs @@ -956,7 +956,7 @@ fn main() { ), Group::with_title( Level::HELP - .primary_title("use `break` on its own without a value inside this `while` loop"), + .secondary_title("use `break` on its own without a value inside this `while` loop"), ) .element( Snippet::source(source) @@ -1155,7 +1155,7 @@ fn nsize() { .label("the size of `V0usize` is smaller than the size of `[usize; 2]`"), ), ), - Group::with_title(Level::NOTE.primary_title("required by a bound in `is_transmutable`")) + Group::with_title(Level::NOTE.secondary_title("required by a bound in `is_transmutable`")) .element( Snippet::source(source) .line_start(1) @@ -1416,7 +1416,7 @@ outer_macro!(FirstStruct, FirstAttrStruct); Level::NOTE .message("a `macro_rules!` definition is non-local if it is nested inside an item and has a `#[macro_export]` attribute") ), - Group::with_title(Level::NOTE.primary_title("the lint level is defined here")) + Group::with_title(Level::NOTE.secondary_title("the lint level is defined here")) .element( Snippet::source(source) .line_start(1) @@ -1523,7 +1523,7 @@ macro_rules! inline { .annotation(AnnotationKind::Primary.span(916..919)), ), Group::with_title( - Level::HELP.primary_title("you must specify a type for this binding, like `i32`"), + Level::HELP.secondary_title("you must specify a type for this binding, like `i32`"), ) .element( Snippet::source(aux_source) @@ -1695,7 +1695,7 @@ fn main() {} .label("patterns `NonEmptyEnum5::V1`, `NonEmptyEnum5::V2`, `NonEmptyEnum5::V3` and 2 more not covered") ), ), - Group::with_title(Level::NOTE.primary_title("`NonEmptyEnum5` defined here")) + Group::with_title(Level::NOTE.secondary_title("`NonEmptyEnum5` defined here")) .element( Snippet::source(source) .line_start(1) @@ -1713,7 +1713,7 @@ fn main() {} ), Group::with_title( Level::HELP - .primary_title("ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown, or multiple match arms") + .secondary_title("ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown, or multiple match arms") ) .element( Snippet::source(source) @@ -1790,7 +1790,7 @@ fn main() { ), Group::with_title( Level::NOTE - .primary_title("for a trait to be dyn compatible it needs to allow building a vtable\nfor more information, visit ")) + .secondary_title("for a trait to be dyn compatible it needs to allow building a vtable\nfor more information, visit ")) .element( Origin::path("$SRC_DIR/core/src/cmp.rs") .line(334) @@ -2014,7 +2014,7 @@ fn main() { ) .element( Level::NOTE.message("`Iterator::map`, like many of the methods on `Iterator`, gets executed lazily, meaning that its effects won't be visible until it is iterated")), - Group::with_title(Level::HELP.primary_title("you might have meant to use `Iterator::for_each`")) + Group::with_title(Level::HELP.secondary_title("you might have meant to use `Iterator::for_each`")) .element( Snippet::source(source) .path("$DIR/lint_map_unit_fn.rs") @@ -2087,7 +2087,7 @@ fn main() { .path("$DIR/bad-char-literals.rs") .annotation(AnnotationKind::Primary.span(204..205)), ), - Group::with_title(Level::HELP.primary_title("escape the character")).element( + Group::with_title(Level::HELP.secondary_title("escape the character")).element( Snippet::source(source) .path("$DIR/bad-char-literals.rs") .line_start(1) @@ -2134,7 +2134,7 @@ fn main() {} .path("$DIR/unclosed-1.rs") .annotation(AnnotationKind::Primary.span(0..221)), ), - Group::with_title(Level::NOTE.primary_title("frontmatter opening here was not closed")) + Group::with_title(Level::NOTE.secondary_title("frontmatter opening here was not closed")) .element( Snippet::source(source) .path("$DIR/unclosed-1.rs") @@ -2187,7 +2187,7 @@ fn foo() -> &str { .path("$DIR/unclosed-2.rs") .annotation(AnnotationKind::Primary.span(0..377)), ), - Group::with_title(Level::NOTE.primary_title("frontmatter opening here was not closed")) + Group::with_title(Level::NOTE.secondary_title("frontmatter opening here was not closed")) .element( Snippet::source(source) .path("$DIR/unclosed-2.rs") @@ -2246,7 +2246,7 @@ fn foo(x: i32) -> i32 { .annotation(AnnotationKind::Primary.span(302..310)), ), Group::with_title( - Level::NOTE.primary_title("frontmatter close should not be preceded by whitespace"), + Level::NOTE.secondary_title("frontmatter close should not be preceded by whitespace"), ) .element( Snippet::source(source) @@ -2292,7 +2292,7 @@ fn main() {} .path("$DIR/unclosed-4.rs") .annotation(AnnotationKind::Primary.span(0..43)), ), - Group::with_title(Level::NOTE.primary_title("frontmatter opening here was not closed")) + Group::with_title(Level::NOTE.secondary_title("frontmatter opening here was not closed")) .element( Snippet::source(source) .path("$DIR/unclosed-4.rs") @@ -2340,7 +2340,7 @@ fn main() {} .path("$DIR/unclosed-5.rs") .annotation(AnnotationKind::Primary.span(0..176)), ), - Group::with_title(Level::NOTE.primary_title("frontmatter opening here was not closed")) + Group::with_title(Level::NOTE.secondary_title("frontmatter opening here was not closed")) .element( Snippet::source(source) .path("$DIR/unclosed-5.rs") @@ -2479,14 +2479,14 @@ pub enum E2 { ), ), Group::with_title( - Level::HELP.primary_title("use the tuple variant pattern syntax instead"), + Level::HELP.secondary_title("use the tuple variant pattern syntax instead"), ) .element( Snippet::source(source) .path("$DIR/pat-tuple-field-count-cross.rs") .patch(Patch::new(1760..1766, r#"E1::Z1()"#)), ), - Group::with_title(Level::HELP.primary_title("a unit variant with a similar name exists")) + Group::with_title(Level::HELP.secondary_title("a unit variant with a similar name exists")) .element( Snippet::source(source) .path("$DIR/pat-tuple-field-count-cross.rs") @@ -2719,7 +2719,7 @@ fn main() { .label("arguments to this function are incorrect"), ), ), - Group::with_title(Level::NOTE.primary_title("function defined here")).element( + Group::with_title(Level::NOTE.secondary_title("function defined here")).element( Snippet::source(source) .path("$DIR/short-error-format.rs") .annotation(AnnotationKind::Context.span(48..54).label("")) @@ -2798,12 +2798,12 @@ pub struct Foo; //~^ ERROR .element( Level::NOTE.message("bare URLs are not automatically turned into clickable links"), ), - Group::with_title(Level::NOTE.primary_title("the lint level is defined here")).element( + Group::with_title(Level::NOTE.secondary_title("the lint level is defined here")).element( Snippet::source(source_0) .path("$DIR/diagnostic-width.rs") .annotation(AnnotationKind::Primary.span(49..67)), ), - Group::with_title(Level::HELP.primary_title("use an automatic link instead")).element( + Group::with_title(Level::HELP.secondary_title("use an automatic link instead")).element( Snippet::source(source_1) .path("$DIR/diagnostic-width.rs") .line_start(4) @@ -2861,7 +2861,8 @@ fn main() { .element(Level::NOTE.message(long_title2)) .element(Level::NOTE.message("`#[warn(array_into_iter)]` on by default")), Group::with_title( - Level::HELP.primary_title("use `.iter()` instead of `.into_iter()` to avoid ambiguity"), + Level::HELP + .secondary_title("use `.iter()` instead of `.into_iter()` to avoid ambiguity"), ) .element( Snippet::source(source2) @@ -2869,7 +2870,7 @@ fn main() { .line_start(3) .patch(Patch::new(10..19, "iter")), ), - Group::with_title(Level::HELP.primary_title(long_title3)).element( + Group::with_title(Level::HELP.secondary_title(long_title3)).element( Snippet::source(source2) .path("lint_example.rs") .line_start(3) @@ -2957,7 +2958,8 @@ fn main() { .annotation(AnnotationKind::Primary.span(587..588)), ), Group::with_title( - Level::NOTE.primary_title("the foreign item type `Box` doesn't implement `Add`"), + Level::NOTE + .secondary_title("the foreign item type `Box` doesn't implement `Add`"), ) .element( Origin::path("$SRC_DIR/alloc/src/boxed.rs") @@ -3098,7 +3100,7 @@ fn main() { .element( Level::HELP.message("items from traits can only be used if the trait is in scope"), ), - Group::with_title(Level::HELP.primary_title(title_1)).element( + Group::with_title(Level::HELP.secondary_title(title_1)).element( Snippet::source("struct MyStruct;\n") .path("$DIR/dont-project-to-specializable-projection.rs") .line_start(6) @@ -3191,7 +3193,7 @@ fn main() { ) .annotation(AnnotationKind::Primary.span(309..311)), ), - Group::with_title(Level::NOTE.primary_title(title_1)) + Group::with_title(Level::NOTE.secondary_title(title_1)) .element( Origin::path("$SRC_DIR/std/src/io/error.rs") .line(65) @@ -3364,7 +3366,7 @@ which is required by `&mut Ipv4Addr: proc_macro::ext::RepIteratorExt`"#; ) .element(Level::NOTE.message(title_1)), Group::with_title( - Level::NOTE.primary_title("the traits `Iterator` and `ToTokens` must be implemented"), + Level::NOTE.secondary_title("the traits `Iterator` and `ToTokens` must be implemented"), ) .element( Origin::path("$SRC_DIR/proc_macro/src/to_tokens.rs") @@ -3547,7 +3549,7 @@ fn main() {} ) .element(Level::WARNING.message(title_0)) .element(Level::NOTE.message(title_1)), - Group::with_title(Level::NOTE.primary_title("the lint level is defined here")).element( + Group::with_title(Level::NOTE.secondary_title("the lint level is defined here")).element( Snippet::source(source) .path("$DIR/unsafe-extern-suggestion.rs") .annotation(AnnotationKind::Primary.span(25..49)), @@ -3630,20 +3632,20 @@ fn panic(_: &core::panic::PanicInfo) -> ! { loop {} } ) .element(Level::NOTE.message(title_0)), Group::with_title( - Level::NOTE.primary_title("`core::alloc::Layout` is defined in crate `core`"), + Level::NOTE.secondary_title("`core::alloc::Layout` is defined in crate `core`"), ) .element( Origin::path("$SRC_DIR/core/src/alloc/layout.rs") .line(40) .char_column(0), ), - Group::with_title(Level::NOTE.primary_title("`Layout` is defined in the current crate")) + Group::with_title(Level::NOTE.secondary_title("`Layout` is defined in the current crate")) .element( Snippet::source(source) .path("$DIR/alloc-error-handler-bad-signature-2.rs") .annotation(AnnotationKind::Primary.span(91..104)), ), - Group::with_title(Level::NOTE.primary_title("function defined here")).element( + Group::with_title(Level::NOTE.secondary_title("function defined here")).element( Snippet::source(source) .path("$DIR/alloc-error-handler-bad-signature-2.rs") .annotation(AnnotationKind::Context.span(142..154).label("")) @@ -3788,7 +3790,7 @@ fn main() { .label("pattern `Some(Private { misc: true, .. })` not covered"), ), ), - Group::with_title(Level::NOTE.primary_title(title_1)) + Group::with_title(Level::NOTE.secondary_title(title_1)) .element( Origin::path("$SRC_DIR/core/src/option.rs") .line(593) @@ -3802,7 +3804,7 @@ fn main() { .element(Padding) .element(Level::NOTE.message("not covered")) .element(Level::NOTE.message("the matched value is of type `Option`")), - Group::with_title(Level::HELP.primary_title(title_2)).element( + Group::with_title(Level::HELP.secondary_title(title_2)).element( Snippet::source(source) .path("$DIR/match-privately-empty.rs") .line_start(17) @@ -3876,7 +3878,7 @@ for more information, visit ::default()", - )), - ), + Group::with_title(Level::HELP.secondary_title("consider using the `Default` trait")) + .element( + Snippet::source(source) + .path("$DIR/multi-suggestion.rs") + .patch(Patch::new(396..396, "<")) + .patch(Patch::new( + 421..423, + " as std::default::Default>::default()", + )), + ), ]; let expected_ascii = str![[r#" @@ -4326,7 +4329,7 @@ fn main() { .annotation(AnnotationKind::Primary.span(220..223)), ), Group::with_title( - Level::NOTE.primary_title("constructor is not visible here due to private fields"), + Level::NOTE.secondary_title("constructor is not visible here due to private fields"), ) .element( Origin::path("$SRC_DIR/alloc/src/boxed.rs") @@ -4337,7 +4340,7 @@ fn main() { .element(Level::NOTE.message("private field")) .element(Padding) .element(Level::NOTE.message("private field")), - Group::with_title(Level::HELP.primary_title( + Group::with_title(Level::HELP.secondary_title( "you might have meant to use an associated function to build this type", )) .element( @@ -4361,15 +4364,16 @@ fn main() { .patch(Patch::new(223..280, "::new_in(_, _)")), ) .element(Level::NOTE.no_name().message("and 12 other candidates")), - Group::with_title(Level::HELP.primary_title("consider using the `Default` trait")).element( - Snippet::source(source) - .path("$DIR/suggest-box-new.rs") - .patch(Patch::new(220..220, "<")) - .patch(Patch::new( - 223..280, - " as std::default::Default>::default()", - )), - ), + Group::with_title(Level::HELP.secondary_title("consider using the `Default` trait")) + .element( + Snippet::source(source) + .path("$DIR/suggest-box-new.rs") + .patch(Patch::new(220..220, "<")) + .patch(Patch::new( + 223..280, + " as std::default::Default>::default()", + )), + ), ]; let expected_ascii = str![[r#" @@ -4529,7 +4533,7 @@ fn main() {} ), Group::with_title( Level::HELP - .primary_title("some of the expressions' fields have a method of the same name"), + .secondary_title("some of the expressions' fields have a method of the same name"), ) .element( Snippet::source(source) @@ -4673,7 +4677,7 @@ If your compilation actually takes a long time, you can safely allow the lint."; .char_column(4), ) .element(Level::NOTE.message(title_0)), - Group::with_title(Level::HELP.primary_title("the constant being evaluated")) + Group::with_title(Level::HELP.secondary_title("the constant being evaluated")) .element( Snippet::source(source) .path("$DIR/timeout.rs")