diff options
| author | Michael Goulet <michael@errs.io> | 2025-02-21 00:29:56 +0000 |
|---|---|---|
| committer | Michael Goulet <michael@errs.io> | 2025-02-21 00:54:01 +0000 |
| commit | 160905b6253f42967ed4aef4b98002944c7df24c (patch) | |
| tree | f9b1d1c27a5beb012e272ecfdecfda62f8419a7b | |
| parent | 0a7ab1d6df4a2cfac819b0bada85b9142ac8ba26 (diff) | |
| download | rust-160905b6253f42967ed4aef4b98002944c7df24c.tar.gz rust-160905b6253f42967ed4aef4b98002944c7df24c.zip | |
Trim suggestion part before generating highlights
36 files changed, 106 insertions, 113 deletions
diff --git a/compiler/rustc_errors/src/emitter.rs b/compiler/rustc_errors/src/emitter.rs index 634afacf539..f7f84239308 100644 --- a/compiler/rustc_errors/src/emitter.rs +++ b/compiler/rustc_errors/src/emitter.rs @@ -2216,12 +2216,7 @@ impl HumanEmitter { if let DisplaySuggestion::Diff | DisplaySuggestion::Underline | DisplaySuggestion::Add = show_code_change { - for mut part in parts { - // If this is a replacement of, e.g. `"a"` into `"ab"`, adjust the - // suggestion and snippet to look as if we just suggested to add - // `"b"`, which is typically much easier for the user to understand. - part.trim_trivial_replacements(sm); - + for part in parts { let snippet = if let Ok(snippet) = sm.span_to_snippet(part.span) { snippet } else { diff --git a/compiler/rustc_errors/src/lib.rs b/compiler/rustc_errors/src/lib.rs index 0016dacc8b2..ceed0cd94fc 100644 --- a/compiler/rustc_errors/src/lib.rs +++ b/compiler/rustc_errors/src/lib.rs @@ -403,7 +403,12 @@ impl CodeSuggestion { // or deleted code in order to point at the correct column *after* substitution. let mut acc = 0; let mut only_capitalization = false; - for part in &substitution.parts { + for part in &mut substitution.parts { + // If this is a replacement of, e.g. `"a"` into `"ab"`, adjust the + // suggestion and snippet to look as if we just suggested to add + // `"b"`, which is typically much easier for the user to understand. + part.trim_trivial_replacements(sm); + only_capitalization |= is_case_difference(sm, &part.snippet, part.span); let cur_lo = sm.lookup_char_pos(part.span.lo()); if prev_hi.line == cur_lo.line { diff --git a/src/tools/clippy/tests/ui/async_yields_async.stderr b/src/tools/clippy/tests/ui/async_yields_async.stderr index 474914299d0..8c023d0d61f 100644 --- a/src/tools/clippy/tests/ui/async_yields_async.stderr +++ b/src/tools/clippy/tests/ui/async_yields_async.stderr @@ -14,9 +14,9 @@ LL | | }; = help: to override `-D warnings` add `#[allow(clippy::async_yields_async)]` help: consider awaiting this value | -LL ~ async { -LL + 3 -LL + }.await +LL | async { +LL | 3 +LL ~ }.await | error: an async construct yields a type which is itself awaitable @@ -46,9 +46,9 @@ LL | | }; | help: consider awaiting this value | -LL ~ async { -LL + 3 -LL + }.await +LL | async { +LL | 3 +LL ~ }.await | error: an async construct yields a type which is itself awaitable diff --git a/src/tools/clippy/tests/ui/fn_to_numeric_cast_any.stderr b/src/tools/clippy/tests/ui/fn_to_numeric_cast_any.stderr index 895297a0400..0238e3a9136 100644 --- a/src/tools/clippy/tests/ui/fn_to_numeric_cast_any.stderr +++ b/src/tools/clippy/tests/ui/fn_to_numeric_cast_any.stderr @@ -152,7 +152,7 @@ LL | f as usize help: did you mean to invoke the function? | LL | f() as usize - | + | ++ error: casting function pointer `T::static_method` to `usize` --> tests/ui/fn_to_numeric_cast_any.rs:62:5 @@ -163,7 +163,7 @@ LL | T::static_method as usize help: did you mean to invoke the function? | LL | T::static_method() as usize - | + | ++ error: casting function pointer `(clos as fn(u32) -> u32)` to `usize` --> tests/ui/fn_to_numeric_cast_any.rs:69:13 diff --git a/src/tools/clippy/tests/ui/implicit_return.stderr b/src/tools/clippy/tests/ui/implicit_return.stderr index 7ea72307450..936a779fa74 100644 --- a/src/tools/clippy/tests/ui/implicit_return.stderr +++ b/src/tools/clippy/tests/ui/implicit_return.stderr @@ -9,7 +9,7 @@ LL | true help: add `return` as shown | LL | return true - | + | ++++++ error: missing `return` statement --> tests/ui/implicit_return.rs:19:15 @@ -122,7 +122,7 @@ LL | format!("test {}", "test") help: add `return` as shown | LL | return format!("test {}", "test") - | + | ++++++ error: missing `return` statement --> tests/ui/implicit_return.rs:90:5 @@ -133,7 +133,7 @@ LL | m!(true, false) help: add `return` as shown | LL | return m!(true, false) - | + | ++++++ error: missing `return` statement --> tests/ui/implicit_return.rs:96:13 @@ -169,10 +169,8 @@ LL | | } | help: add `return` as shown | -LL ~ return loop { -LL + m!(true); -LL + } - | +LL | return loop { + | ++++++ error: missing `return` statement --> tests/ui/implicit_return.rs:130:5 @@ -183,7 +181,7 @@ LL | true help: add `return` as shown | LL | return true - | + | ++++++ error: aborting due to 16 previous errors diff --git a/src/tools/clippy/tests/ui/manual_flatten.stderr b/src/tools/clippy/tests/ui/manual_flatten.stderr index cf1b0a1c8bb..93f7f11b5e6 100644 --- a/src/tools/clippy/tests/ui/manual_flatten.stderr +++ b/src/tools/clippy/tests/ui/manual_flatten.stderr @@ -196,11 +196,9 @@ LL | | } | |_________^ help: try | -LL ~ for n in vec![ -LL + -LL + Some(1), -LL + Some(2), -LL + Some(3) +LL | for n in vec![ +... +LL | Some(3) LL ~ ].iter().flatten() { | diff --git a/src/tools/clippy/tests/ui/too_long_first_doc_paragraph-fix.stderr b/src/tools/clippy/tests/ui/too_long_first_doc_paragraph-fix.stderr index 6ef333f0cfd..84a574017a9 100644 --- a/src/tools/clippy/tests/ui/too_long_first_doc_paragraph-fix.stderr +++ b/src/tools/clippy/tests/ui/too_long_first_doc_paragraph-fix.stderr @@ -12,7 +12,7 @@ LL | | /// 200 characters so I needed to write something longeeeeeeer. = help: to override `-D warnings` add `#[allow(clippy::too_long_first_doc_paragraph)]` help: add an empty line | -LL ~ /// A very short summary. +LL | /// A very short summary. LL + /// | diff --git a/src/tools/clippy/tests/ui/too_long_first_doc_paragraph.stderr b/src/tools/clippy/tests/ui/too_long_first_doc_paragraph.stderr index 95f42349b9b..8bc853132ec 100644 --- a/src/tools/clippy/tests/ui/too_long_first_doc_paragraph.stderr +++ b/src/tools/clippy/tests/ui/too_long_first_doc_paragraph.stderr @@ -12,8 +12,8 @@ LL | | //! 200 characters so I needed to write something longeeeeeeer. = help: to override `-D warnings` add `#[allow(clippy::too_long_first_doc_paragraph)]` help: add an empty line | -LL ~ //! A very short summary. -LL + //! +LL | //! A very short summary. +LL ~ //! LL ~ //! A much longer explanation that goes into a lot more detail about | diff --git a/tests/ui/coverage-attr/bad-attr-ice.feat.stderr b/tests/ui/coverage-attr/bad-attr-ice.feat.stderr index 50e1c39d4f8..dc84394fe3c 100644 --- a/tests/ui/coverage-attr/bad-attr-ice.feat.stderr +++ b/tests/ui/coverage-attr/bad-attr-ice.feat.stderr @@ -7,9 +7,9 @@ LL | #[coverage] help: the following are the possible correct uses | LL | #[coverage(off)] - | + | +++++ LL | #[coverage(on)] - | + | ++++ error: aborting due to 1 previous error diff --git a/tests/ui/coverage-attr/bad-attr-ice.nofeat.stderr b/tests/ui/coverage-attr/bad-attr-ice.nofeat.stderr index e8bdd99c9b9..49b8974bfdf 100644 --- a/tests/ui/coverage-attr/bad-attr-ice.nofeat.stderr +++ b/tests/ui/coverage-attr/bad-attr-ice.nofeat.stderr @@ -7,9 +7,9 @@ LL | #[coverage] help: the following are the possible correct uses | LL | #[coverage(off)] - | + | +++++ LL | #[coverage(on)] - | + | ++++ error[E0658]: the `#[coverage]` attribute is an experimental feature --> $DIR/bad-attr-ice.rs:11:1 diff --git a/tests/ui/coverage-attr/word-only.stderr b/tests/ui/coverage-attr/word-only.stderr index bad50b0c961..612301885dc 100644 --- a/tests/ui/coverage-attr/word-only.stderr +++ b/tests/ui/coverage-attr/word-only.stderr @@ -7,9 +7,9 @@ LL | #[coverage] help: the following are the possible correct uses | LL | #[coverage(off)] - | + | +++++ LL | #[coverage(on)] - | + | ++++ error: malformed `coverage` attribute input --> $DIR/word-only.rs:17:5 @@ -20,9 +20,9 @@ LL | #![coverage] help: the following are the possible correct uses | LL | #![coverage(off)] - | + | +++++ LL | #![coverage(on)] - | + | ++++ error: malformed `coverage` attribute input --> $DIR/word-only.rs:21:1 @@ -33,9 +33,9 @@ LL | #[coverage] help: the following are the possible correct uses | LL | #[coverage(off)] - | + | +++++ LL | #[coverage(on)] - | + | ++++ error: malformed `coverage` attribute input --> $DIR/word-only.rs:29:5 @@ -46,9 +46,9 @@ LL | #[coverage] help: the following are the possible correct uses | LL | #[coverage(off)] - | + | +++++ LL | #[coverage(on)] - | + | ++++ error: malformed `coverage` attribute input --> $DIR/word-only.rs:26:1 @@ -59,9 +59,9 @@ LL | #[coverage] help: the following are the possible correct uses | LL | #[coverage(off)] - | + | +++++ LL | #[coverage(on)] - | + | ++++ error: malformed `coverage` attribute input --> $DIR/word-only.rs:39:5 @@ -72,9 +72,9 @@ LL | #[coverage] help: the following are the possible correct uses | LL | #[coverage(off)] - | + | +++++ LL | #[coverage(on)] - | + | ++++ error: malformed `coverage` attribute input --> $DIR/word-only.rs:44:5 @@ -85,9 +85,9 @@ LL | #[coverage] help: the following are the possible correct uses | LL | #[coverage(off)] - | + | +++++ LL | #[coverage(on)] - | + | ++++ error: malformed `coverage` attribute input --> $DIR/word-only.rs:35:1 @@ -98,9 +98,9 @@ LL | #[coverage] help: the following are the possible correct uses | LL | #[coverage(off)] - | + | +++++ LL | #[coverage(on)] - | + | ++++ error: malformed `coverage` attribute input --> $DIR/word-only.rs:53:5 @@ -111,9 +111,9 @@ LL | #[coverage] help: the following are the possible correct uses | LL | #[coverage(off)] - | + | +++++ LL | #[coverage(on)] - | + | ++++ error: malformed `coverage` attribute input --> $DIR/word-only.rs:58:5 @@ -124,9 +124,9 @@ LL | #[coverage] help: the following are the possible correct uses | LL | #[coverage(off)] - | + | +++++ LL | #[coverage(on)] - | + | ++++ error: malformed `coverage` attribute input --> $DIR/word-only.rs:50:1 @@ -137,9 +137,9 @@ LL | #[coverage] help: the following are the possible correct uses | LL | #[coverage(off)] - | + | +++++ LL | #[coverage(on)] - | + | ++++ error: malformed `coverage` attribute input --> $DIR/word-only.rs:64:1 @@ -150,9 +150,9 @@ LL | #[coverage] help: the following are the possible correct uses | LL | #[coverage(off)] - | + | +++++ LL | #[coverage(on)] - | + | ++++ error[E0788]: coverage attribute not allowed here --> $DIR/word-only.rs:21:1 diff --git a/tests/ui/error-codes/E0259.stderr b/tests/ui/error-codes/E0259.stderr index 975d1a161a0..1833fe90f3d 100644 --- a/tests/ui/error-codes/E0259.stderr +++ b/tests/ui/error-codes/E0259.stderr @@ -11,7 +11,7 @@ LL | extern crate test as alloc; help: you can use `as` to change the binding name of the import | LL | extern crate test as other_alloc; - | + | ++++++ error: aborting due to 1 previous error diff --git a/tests/ui/error-codes/E0260.stderr b/tests/ui/error-codes/E0260.stderr index 35698c65359..10811d1f318 100644 --- a/tests/ui/error-codes/E0260.stderr +++ b/tests/ui/error-codes/E0260.stderr @@ -11,7 +11,7 @@ LL | mod alloc { help: you can use `as` to change the binding name of the import | LL | extern crate alloc as other_alloc; - | + | ++++++++++++++ error: aborting due to 1 previous error diff --git a/tests/ui/errors/issue-89280-emitter-overflow-splice-lines.stderr b/tests/ui/errors/issue-89280-emitter-overflow-splice-lines.stderr index 54bde98b57f..d9acdbea3fc 100644 --- a/tests/ui/errors/issue-89280-emitter-overflow-splice-lines.stderr +++ b/tests/ui/errors/issue-89280-emitter-overflow-splice-lines.stderr @@ -12,11 +12,8 @@ LL | | )) {} = note: `#[warn(anonymous_parameters)]` on by default help: try naming the parameter or explicitly ignoring it | -LL ~ fn test(x: u32, _: ( -LL + -LL + -LL ~ )) {} - | +LL | fn test(x: u32, _: ( + | ++ warning: 1 warning emitted diff --git a/tests/ui/fn/issue-3044.stderr b/tests/ui/fn/issue-3044.stderr index 8351818dc89..787eeec09cc 100644 --- a/tests/ui/fn/issue-3044.stderr +++ b/tests/ui/fn/issue-3044.stderr @@ -11,8 +11,8 @@ note: method defined here --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL help: provide the argument | -LL ~ needlesArr.iter().fold(|x, y| { -LL + +LL | needlesArr.iter().fold(|x, y| { +LL | LL ~ }, /* f */); | diff --git a/tests/ui/imports/issue-45799-bad-extern-crate-rename-suggestion-formatting.stderr b/tests/ui/imports/issue-45799-bad-extern-crate-rename-suggestion-formatting.stderr index 80cea1a83d9..2621f913186 100644 --- a/tests/ui/imports/issue-45799-bad-extern-crate-rename-suggestion-formatting.stderr +++ b/tests/ui/imports/issue-45799-bad-extern-crate-rename-suggestion-formatting.stderr @@ -8,7 +8,7 @@ LL | extern crate std; help: you can use `as` to change the binding name of the import | LL | extern crate std as other_std; - | + | ++++++++++++ error: aborting due to 1 previous error diff --git a/tests/ui/imports/issue-45829/rename-extern-vs-use.stderr b/tests/ui/imports/issue-45829/rename-extern-vs-use.stderr index 8f2f7bbac0c..f33b093725f 100644 --- a/tests/ui/imports/issue-45829/rename-extern-vs-use.stderr +++ b/tests/ui/imports/issue-45829/rename-extern-vs-use.stderr @@ -10,7 +10,7 @@ LL | extern crate issue_45829_b as bar; help: you can use `as` to change the binding name of the import | LL | extern crate issue_45829_b as other_bar; - | + | ++++++ error: aborting due to 1 previous error diff --git a/tests/ui/imports/issue-45829/rename-extern.stderr b/tests/ui/imports/issue-45829/rename-extern.stderr index 46560ef9244..2a3a05d1e7b 100644 --- a/tests/ui/imports/issue-45829/rename-extern.stderr +++ b/tests/ui/imports/issue-45829/rename-extern.stderr @@ -10,7 +10,7 @@ LL | extern crate issue_45829_b as issue_45829_a; help: you can use `as` to change the binding name of the import | LL | extern crate issue_45829_b as other_issue_45829_a; - | + | ++++++ error: aborting due to 1 previous error diff --git a/tests/ui/imports/multiple-extern-by-macro-for-buitlin.stderr b/tests/ui/imports/multiple-extern-by-macro-for-buitlin.stderr index a84a6c42aa8..bc975573281 100644 --- a/tests/ui/imports/multiple-extern-by-macro-for-buitlin.stderr +++ b/tests/ui/imports/multiple-extern-by-macro-for-buitlin.stderr @@ -15,7 +15,7 @@ LL | m!(); help: you can use `as` to change the binding name of the import | LL | extern crate std as other_core; - | + | ++++++ error: aborting due to 1 previous error diff --git a/tests/ui/imports/multiple-extern-by-macro-for-custom.stderr b/tests/ui/imports/multiple-extern-by-macro-for-custom.stderr index 556d75a4dbb..f1b60bbe39d 100644 --- a/tests/ui/imports/multiple-extern-by-macro-for-custom.stderr +++ b/tests/ui/imports/multiple-extern-by-macro-for-custom.stderr @@ -15,7 +15,7 @@ LL | m!(); help: you can use `as` to change the binding name of the import | LL | extern crate std as other_empty; - | + | ++++++ error: aborting due to 1 previous error diff --git a/tests/ui/imports/multiple-extern-by-macro-for-inexist.stderr b/tests/ui/imports/multiple-extern-by-macro-for-inexist.stderr index ec34489f232..13e1aaacd70 100644 --- a/tests/ui/imports/multiple-extern-by-macro-for-inexist.stderr +++ b/tests/ui/imports/multiple-extern-by-macro-for-inexist.stderr @@ -21,7 +21,7 @@ LL | m!(); help: you can use `as` to change the binding name of the import | LL | extern crate std as other_non_existent; - | + | ++++++ error: aborting due to 2 previous errors diff --git a/tests/ui/on-unimplemented/bad-annotation.stderr b/tests/ui/on-unimplemented/bad-annotation.stderr index 9bb9423788c..4ceea779b29 100644 --- a/tests/ui/on-unimplemented/bad-annotation.stderr +++ b/tests/ui/on-unimplemented/bad-annotation.stderr @@ -7,9 +7,9 @@ LL | #[rustc_on_unimplemented] help: the following are the possible correct uses | LL | #[rustc_on_unimplemented = "message"] - | + | +++++++++++ LL | #[rustc_on_unimplemented(/*opt*/ message = "...", /*opt*/ label = "...", /*opt*/ note = "...")] - | + | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ error[E0230]: there is no parameter `C` on trait `BadAnnotation2` --> $DIR/bad-annotation.rs:22:1 diff --git a/tests/ui/panic-handler/weak-lang-item.stderr b/tests/ui/panic-handler/weak-lang-item.stderr index de351d2c3e4..5dcb37df689 100644 --- a/tests/ui/panic-handler/weak-lang-item.stderr +++ b/tests/ui/panic-handler/weak-lang-item.stderr @@ -8,7 +8,7 @@ LL | extern crate core; help: you can use `as` to change the binding name of the import | LL | extern crate core as other_core; - | + | +++++++++++++ error: `#[panic_handler]` function required, but not found diff --git a/tests/ui/pattern/usefulness/empty-types.exhaustive_patterns.stderr b/tests/ui/pattern/usefulness/empty-types.exhaustive_patterns.stderr index 23821decd6e..d241f417553 100644 --- a/tests/ui/pattern/usefulness/empty-types.exhaustive_patterns.stderr +++ b/tests/ui/pattern/usefulness/empty-types.exhaustive_patterns.stderr @@ -37,7 +37,7 @@ help: ensure that all possible cases are being handled by adding a match arm wit | LL ~ match ref_never { LL + _ => todo!(), -LL + } +LL ~ } | error: unreachable pattern @@ -100,7 +100,7 @@ help: ensure that all possible cases are being handled by adding a match arm wit | LL ~ match res_u32_never { LL + Ok(_) => todo!(), -LL + } +LL ~ } | error: unreachable pattern @@ -374,7 +374,7 @@ help: ensure that all possible cases are being handled by adding a match arm wit | LL ~ match slice_never { LL + _ => todo!(), -LL + } +LL ~ } | error[E0004]: non-exhaustive patterns: `&[]` not covered @@ -415,7 +415,7 @@ help: ensure that all possible cases are being handled by adding a match arm wit | LL ~ match *slice_never { LL + _ => todo!(), -LL + } +LL ~ } | error: unreachable pattern @@ -462,7 +462,7 @@ help: ensure that all possible cases are being handled by adding a match arm wit | LL ~ match array_0_never { LL + _ => todo!(), -LL + } +LL ~ } | error: unreachable pattern diff --git a/tests/ui/pattern/usefulness/empty-types.never_pats.stderr b/tests/ui/pattern/usefulness/empty-types.never_pats.stderr index 84aefe7d963..ea63d7ba1af 100644 --- a/tests/ui/pattern/usefulness/empty-types.never_pats.stderr +++ b/tests/ui/pattern/usefulness/empty-types.never_pats.stderr @@ -46,7 +46,7 @@ help: ensure that all possible cases are being handled by adding a match arm wit | LL ~ match ref_never { LL + _ => todo!(), -LL + } +LL ~ } | error: unreachable pattern @@ -76,7 +76,7 @@ help: ensure that all possible cases are being handled by adding a match arm wit | LL ~ match res_u32_never { LL + Ok(_) => todo!(), -LL + } +LL ~ } | error[E0004]: non-exhaustive patterns: `Ok(1_u32..=u32::MAX)` not covered @@ -321,7 +321,7 @@ help: ensure that all possible cases are being handled by adding a match arm wit | LL ~ match slice_never { LL + _ => todo!(), -LL + } +LL ~ } | error[E0004]: non-exhaustive patterns: `&[!, ..]` not covered @@ -376,7 +376,7 @@ help: ensure that all possible cases are being handled by adding a match arm wit | LL ~ match *slice_never { LL + _ => todo!(), -LL + } +LL ~ } | error[E0004]: non-exhaustive patterns: type `[!; 0]` is non-empty @@ -390,7 +390,7 @@ help: ensure that all possible cases are being handled by adding a match arm wit | LL ~ match array_0_never { LL + _ => todo!(), -LL + } +LL ~ } | error: unreachable pattern @@ -502,7 +502,7 @@ help: ensure that all possible cases are being handled by adding a match arm wit | LL ~ match *ref_tuple_half_never { LL + _ => todo!(), -LL + } +LL ~ } | error: unreachable pattern diff --git a/tests/ui/pattern/usefulness/empty-types.normal.stderr b/tests/ui/pattern/usefulness/empty-types.normal.stderr index f3af74c16c3..a1a44e77744 100644 --- a/tests/ui/pattern/usefulness/empty-types.normal.stderr +++ b/tests/ui/pattern/usefulness/empty-types.normal.stderr @@ -37,7 +37,7 @@ help: ensure that all possible cases are being handled by adding a match arm wit | LL ~ match ref_never { LL + _ => todo!(), -LL + } +LL ~ } | error: unreachable pattern @@ -67,7 +67,7 @@ help: ensure that all possible cases are being handled by adding a match arm wit | LL ~ match res_u32_never { LL + Ok(_) => todo!(), -LL + } +LL ~ } | error[E0004]: non-exhaustive patterns: `Ok(1_u32..=u32::MAX)` not covered @@ -312,7 +312,7 @@ help: ensure that all possible cases are being handled by adding a match arm wit | LL ~ match slice_never { LL + _ => todo!(), -LL + } +LL ~ } | error[E0004]: non-exhaustive patterns: `&[_, ..]` not covered @@ -367,7 +367,7 @@ help: ensure that all possible cases are being handled by adding a match arm wit | LL ~ match *slice_never { LL + _ => todo!(), -LL + } +LL ~ } | error[E0004]: non-exhaustive patterns: type `[!; 0]` is non-empty @@ -381,7 +381,7 @@ help: ensure that all possible cases are being handled by adding a match arm wit | LL ~ match array_0_never { LL + _ => todo!(), -LL + } +LL ~ } | error: unreachable pattern @@ -493,7 +493,7 @@ help: ensure that all possible cases are being handled by adding a match arm wit | LL ~ match *ref_tuple_half_never { LL + _ => todo!(), -LL + } +LL ~ } | error: unreachable pattern diff --git a/tests/ui/pattern/usefulness/impl-trait.stderr b/tests/ui/pattern/usefulness/impl-trait.stderr index 34f8eb1e163..c3e1c267b61 100644 --- a/tests/ui/pattern/usefulness/impl-trait.stderr +++ b/tests/ui/pattern/usefulness/impl-trait.stderr @@ -36,7 +36,7 @@ help: ensure that all possible cases are being handled by adding a match arm wit | LL ~ match return_never_rpit(x) { LL + _ => todo!(), -LL + } +LL ~ } | error: unreachable pattern @@ -118,7 +118,7 @@ help: ensure that all possible cases are being handled by adding a match arm wit | LL ~ match return_never_tait(x) { LL + _ => todo!(), -LL + } +LL ~ } | error: unreachable pattern diff --git a/tests/ui/pattern/usefulness/integer-ranges/pointer-sized-int.deny.stderr b/tests/ui/pattern/usefulness/integer-ranges/pointer-sized-int.deny.stderr index 914c6ed60c8..7caee64a33f 100644 --- a/tests/ui/pattern/usefulness/integer-ranges/pointer-sized-int.deny.stderr +++ b/tests/ui/pattern/usefulness/integer-ranges/pointer-sized-int.deny.stderr @@ -154,7 +154,7 @@ help: ensure that all possible cases are being handled by adding a match arm wit | LL ~ match 7usize { LL + _ => todo!(), -LL + } +LL ~ } | error: aborting due to 12 previous errors diff --git a/tests/ui/pattern/usefulness/issue-78123-non-exhaustive-reference.stderr b/tests/ui/pattern/usefulness/issue-78123-non-exhaustive-reference.stderr index 2acde849650..c37a9a51579 100644 --- a/tests/ui/pattern/usefulness/issue-78123-non-exhaustive-reference.stderr +++ b/tests/ui/pattern/usefulness/issue-78123-non-exhaustive-reference.stderr @@ -15,7 +15,7 @@ help: ensure that all possible cases are being handled by adding a match arm wit | LL ~ match a { LL + _ => todo!(), -LL + } +LL ~ } | error: aborting due to 1 previous error diff --git a/tests/ui/resolve/resolve-conflict-extern-crate-vs-extern-crate.stderr b/tests/ui/resolve/resolve-conflict-extern-crate-vs-extern-crate.stderr index 999e9a47d6c..a9b45a18af3 100644 --- a/tests/ui/resolve/resolve-conflict-extern-crate-vs-extern-crate.stderr +++ b/tests/ui/resolve/resolve-conflict-extern-crate-vs-extern-crate.stderr @@ -4,7 +4,7 @@ error[E0259]: the name `std` is defined multiple times help: you can use `as` to change the binding name of the import | LL | extern crate std as other_std; - | + | ++++++++++++ error: aborting due to 1 previous error diff --git a/tests/ui/rfcs/rfc-2008-non-exhaustive/enum_same_crate_empty_match.stderr b/tests/ui/rfcs/rfc-2008-non-exhaustive/enum_same_crate_empty_match.stderr index 45a0ca01a56..100e0a501e0 100644 --- a/tests/ui/rfcs/rfc-2008-non-exhaustive/enum_same_crate_empty_match.stderr +++ b/tests/ui/rfcs/rfc-2008-non-exhaustive/enum_same_crate_empty_match.stderr @@ -38,7 +38,7 @@ help: ensure that all possible cases are being handled by adding a match arm wit | LL ~ match NonExhaustiveEnum::Unit { LL + NonExhaustiveEnum::Unit | NonExhaustiveEnum::Tuple(_) | NonExhaustiveEnum::Struct { .. } => todo!(), -LL + } +LL ~ } | error[E0004]: non-exhaustive patterns: `NormalEnum::Unit`, `NormalEnum::Tuple(_)` and `NormalEnum::Struct { .. }` not covered @@ -65,7 +65,7 @@ help: ensure that all possible cases are being handled by adding a match arm wit | LL ~ match NormalEnum::Unit { LL + NormalEnum::Unit | NormalEnum::Tuple(_) | NormalEnum::Struct { .. } => todo!(), -LL + } +LL ~ } | error: aborting due to 3 previous errors diff --git a/tests/ui/suggestions/incorrect-variant-literal.svg b/tests/ui/suggestions/incorrect-variant-literal.svg index 68cd42deaea..279fd30f216 100644 --- a/tests/ui/suggestions/incorrect-variant-literal.svg +++ b/tests/ui/suggestions/incorrect-variant-literal.svg @@ -103,7 +103,7 @@ </tspan> <tspan x="10px" y="748px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> </tspan> - <tspan x="10px" y="766px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">| </tspan><tspan> Enum::Tuple</tspan><tspan class="fg-ansi256-010">(/* i32 */)</tspan><tspan>;</tspan> + <tspan x="10px" y="766px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">| </tspan><tspan> Enum::Tuple(</tspan><tspan class="fg-ansi256-010">/* i32 */</tspan><tspan>);</tspan> </tspan> <tspan x="10px" y="784px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-010">+++++++++</tspan> </tspan> @@ -581,7 +581,7 @@ </tspan> <tspan x="10px" y="5050px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-009">- </tspan><tspan> Enum::</tspan><tspan class="fg-ansi256-009">tuple</tspan><tspan>();</tspan> </tspan> - <tspan x="10px" y="5068px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-010">+ </tspan><tspan> Enum::</tspan><tspan class="fg-ansi256-010">Tuple(/* i32 */)</tspan><tspan>;</tspan> + <tspan x="10px" y="5068px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-010">+ </tspan><tspan> Enum::</tspan><tspan class="fg-ansi256-010">Tuple</tspan><tspan>(</tspan><tspan class="fg-ansi256-010">/* i32 */</tspan><tspan>);</tspan> </tspan> <tspan x="10px" y="5086px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> </tspan> diff --git a/tests/ui/suggestions/return-bindings.stderr b/tests/ui/suggestions/return-bindings.stderr index 6f906c27ba9..8e396d17dc0 100644 --- a/tests/ui/suggestions/return-bindings.stderr +++ b/tests/ui/suggestions/return-bindings.stderr @@ -22,8 +22,8 @@ LL | | } else { | help: consider returning the local binding `s` | -LL ~ let s: String = if let Some(s) = opt_str { -LL + s +LL | let s: String = if let Some(s) = opt_str { +LL ~ s LL ~ | @@ -54,8 +54,8 @@ LL | | } else { | help: consider returning the local binding `s` | -LL ~ let s: String = if let Some(s) = opt_str { -LL + s +LL | let s: String = if let Some(s) = opt_str { +LL ~ s LL ~ | @@ -71,8 +71,8 @@ LL | String::new() | help: consider returning the local binding `s` | -LL ~ let s = if let Some(s) = opt_str { -LL + s +LL | let s = if let Some(s) = opt_str { +LL ~ s LL ~ } else { | diff --git a/tests/ui/type-alias-impl-trait/bad-tait-no-substs.stderr b/tests/ui/type-alias-impl-trait/bad-tait-no-substs.stderr index 55df117d066..38fbff9d59d 100644 --- a/tests/ui/type-alias-impl-trait/bad-tait-no-substs.stderr +++ b/tests/ui/type-alias-impl-trait/bad-tait-no-substs.stderr @@ -69,7 +69,7 @@ help: ensure that all possible cases are being handled by adding a match arm wit | LL ~ match x { LL + UninhabitedVariants::Tuple(_) => todo!(), -LL + } +LL ~ } | error: aborting due to 5 previous errors diff --git a/tests/ui/type-alias-impl-trait/unconstrained-due-to-bad-pattern.stderr b/tests/ui/type-alias-impl-trait/unconstrained-due-to-bad-pattern.stderr index 6d9c8eabfad..5c9a4688105 100644 --- a/tests/ui/type-alias-impl-trait/unconstrained-due-to-bad-pattern.stderr +++ b/tests/ui/type-alias-impl-trait/unconstrained-due-to-bad-pattern.stderr @@ -9,7 +9,7 @@ help: ensure that all possible cases are being handled by adding a match arm wit | LL ~ match empty_opaque() { LL + _ => todo!(), -LL + } +LL ~ } | error: aborting due to 1 previous error diff --git a/tests/ui/typeck/issue-13853-5.stderr b/tests/ui/typeck/issue-13853-5.stderr index 388d5ec746c..4e483a0a58e 100644 --- a/tests/ui/typeck/issue-13853-5.stderr +++ b/tests/ui/typeck/issue-13853-5.stderr @@ -14,8 +14,8 @@ LL | fn deserialize_token<D: Deserializer<'a>>(_x: D, _y: &'a str) -> &'a st | help: consider returning the local binding `_y` | -LL ~ fn deserialize_token<D: Deserializer<'a>>(_x: D, _y: &'a str) -> &'a str { -LL + _y +LL | fn deserialize_token<D: Deserializer<'a>>(_x: D, _y: &'a str) -> &'a str { +LL ~ _y LL ~ | |
