From c2b3287483fb7fc1be7fdfbfd25044dd7a0320c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Thu, 11 Jul 2024 21:04:01 +0000 Subject: [PATCH] Make `impl` and `!` removal suggestion `short` --- compiler/rustc_parse/src/errors.rs | 4 ++-- .../ui/impl-trait/extra-impl-in-trait-impl.stderr | 14 ++------------ tests/ui/macros/bang-after-name.stderr | 8 +------- tests/ui/macros/missing-bang-in-decl.stderr | 8 +------- 4 files changed, 6 insertions(+), 28 deletions(-) diff --git a/compiler/rustc_parse/src/errors.rs b/compiler/rustc_parse/src/errors.rs index 0f13a8e5e14..d2a765247ad 100644 --- a/compiler/rustc_parse/src/errors.rs +++ b/compiler/rustc_parse/src/errors.rs @@ -1784,7 +1784,7 @@ pub(crate) struct ExpectedTraitInTraitImplFoundType { #[diag(parse_extra_impl_keyword_in_trait_impl)] pub(crate) struct ExtraImplKeywordInTraitImpl { #[primary_span] - #[suggestion(code = "", applicability = "maybe-incorrect", style = "verbose")] + #[suggestion(code = "", applicability = "maybe-incorrect", style = "short")] pub extra_impl_kw: Span, #[note] pub impl_trait_span: Span, @@ -2890,7 +2890,7 @@ pub(crate) struct MacroRulesMissingBang { #[diag(parse_macro_name_remove_bang)] pub(crate) struct MacroNameRemoveBang { #[primary_span] - #[suggestion(code = "", applicability = "machine-applicable", style = "verbose")] + #[suggestion(code = "", applicability = "machine-applicable", style = "short")] pub span: Span, } diff --git a/tests/ui/impl-trait/extra-impl-in-trait-impl.stderr b/tests/ui/impl-trait/extra-impl-in-trait-impl.stderr index e4d14c4807c..91c7da5a04f 100644 --- a/tests/ui/impl-trait/extra-impl-in-trait-impl.stderr +++ b/tests/ui/impl-trait/extra-impl-in-trait-impl.stderr @@ -2,35 +2,25 @@ error: unexpected `impl` keyword --> $DIR/extra-impl-in-trait-impl.rs:8:18 | LL | impl impl Default for S { - | ^^^^^ + | ^^^^^ help: remove the extra `impl` | note: this is parsed as an `impl Trait` type, but a trait is expected at this position --> $DIR/extra-impl-in-trait-impl.rs:8:18 | LL | impl impl Default for S { | ^^^^^^^^^^^^ -help: remove the extra `impl` - | -LL - impl impl Default for S { -LL + impl Default for S { - | error: unexpected `impl` keyword --> $DIR/extra-impl-in-trait-impl.rs:14:6 | LL | impl impl Default for S2 { - | ^^^^^ + | ^^^^^ help: remove the extra `impl` | note: this is parsed as an `impl Trait` type, but a trait is expected at this position --> $DIR/extra-impl-in-trait-impl.rs:14:6 | LL | impl impl Default for S2 { | ^^^^^^^^^^^^ -help: remove the extra `impl` - | -LL - impl impl Default for S2 { -LL + impl Default for S2 { - | error: aborting due to 2 previous errors diff --git a/tests/ui/macros/bang-after-name.stderr b/tests/ui/macros/bang-after-name.stderr index 8433c375c01..27853161e4f 100644 --- a/tests/ui/macros/bang-after-name.stderr +++ b/tests/ui/macros/bang-after-name.stderr @@ -2,13 +2,7 @@ error: macro names aren't followed by a `!` --> $DIR/bang-after-name.rs:4:17 | LL | macro_rules! foo! { - | ^ - | -help: remove the `!` - | -LL - macro_rules! foo! { -LL + macro_rules! foo { - | + | ^ help: remove the `!` error: aborting due to 1 previous error diff --git a/tests/ui/macros/missing-bang-in-decl.stderr b/tests/ui/macros/missing-bang-in-decl.stderr index 348a94ec2c0..aa78c9a6906 100644 --- a/tests/ui/macros/missing-bang-in-decl.stderr +++ b/tests/ui/macros/missing-bang-in-decl.stderr @@ -24,13 +24,7 @@ error: macro names aren't followed by a `!` --> $DIR/missing-bang-in-decl.rs:10:16 | LL | macro_rules bar! { - | ^ - | -help: remove the `!` - | -LL - macro_rules bar! { -LL + macro_rules bar { - | + | ^ help: remove the `!` error: aborting due to 3 previous errors