diff options
| author | bors <bors@rust-lang.org> | 2023-10-23 00:51:35 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2023-10-23 00:51:35 +0000 |
| commit | 111adde7ed86b848e61d1bd3cb431f9c52584317 (patch) | |
| tree | 231d55992194d59c399b3ea6b670ddc3004bee8f /compiler/rustc_builtin_macros/src/errors.rs | |
| parent | 913ceaee96581232cbb8eedb43224f442e0c5287 (diff) | |
| parent | cbc6b65d9a4a404392a928dfc200a7616cfc2c98 (diff) | |
| download | rust-111adde7ed86b848e61d1bd3cb431f9c52584317.tar.gz rust-111adde7ed86b848e61d1bd3cb431f9c52584317.zip | |
Auto merge of #115324 - francorbacho:master, r=davidtwco
Suggest removing redundant arguments in format!() Closes #105225. This is also a follow-up to #105635, which seems to have become stale. r? `@estebank`
Diffstat (limited to 'compiler/rustc_builtin_macros/src/errors.rs')
| -rw-r--r-- | compiler/rustc_builtin_macros/src/errors.rs | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/compiler/rustc_builtin_macros/src/errors.rs b/compiler/rustc_builtin_macros/src/errors.rs index 1238773d58b..fde4270334b 100644 --- a/compiler/rustc_builtin_macros/src/errors.rs +++ b/compiler/rustc_builtin_macros/src/errors.rs @@ -647,6 +647,27 @@ pub(crate) struct FormatPositionalMismatch { } #[derive(Diagnostic)] +#[diag(builtin_macros_format_redundant_args)] +pub(crate) struct FormatRedundantArgs { + #[primary_span] + pub(crate) span: MultiSpan, + pub(crate) n: usize, + + #[note] + pub(crate) note: MultiSpan, + + #[subdiagnostic] + pub(crate) sugg: Option<FormatRedundantArgsSugg>, +} + +#[derive(Subdiagnostic)] +#[multipart_suggestion(builtin_macros_suggestion, applicability = "machine-applicable")] +pub(crate) struct FormatRedundantArgsSugg { + #[suggestion_part(code = "")] + pub(crate) spans: Vec<Span>, +} + +#[derive(Diagnostic)] #[diag(builtin_macros_test_case_non_item)] pub(crate) struct TestCaseNonItem { #[primary_span] |
