about summary refs log tree commit diff
diff options
context:
space:
mode:
authorDavid Wood <david.wood@huawei.com>2022-10-03 15:34:00 +0100
committerDavid Wood <david.wood@huawei.com>2022-10-10 13:32:23 +0100
commitfebbf71219001cd7948c3d1e5ffa68706896d955 (patch)
treea0af68fb8637277797af0f5da0765ce549b05b50
parent691aeaad6c9ee3483f2851695379b348b8a92a43 (diff)
downloadrust-febbf71219001cd7948c3d1e5ffa68706896d955.tar.gz
rust-febbf71219001cd7948c3d1e5ffa68706896d955.zip
macros: tidy up lint changes
Small tweaks to changes made in a previous PR, unrelated to eager
translation.

Signed-off-by: David Wood <david.wood@huawei.com>
-rw-r--r--compiler/rustc_macros/src/diagnostics/diagnostic.rs9
1 files changed, 6 insertions, 3 deletions
diff --git a/compiler/rustc_macros/src/diagnostics/diagnostic.rs b/compiler/rustc_macros/src/diagnostics/diagnostic.rs
index 83040a652b1..406a56cd4ae 100644
--- a/compiler/rustc_macros/src/diagnostics/diagnostic.rs
+++ b/compiler/rustc_macros/src/diagnostics/diagnostic.rs
@@ -105,8 +105,8 @@ impl<'a> LintDiagnosticDerive<'a> {
         });
 
         let msg = builder.each_variant(&mut structure, |mut builder, variant| {
-            // HACK(wafflelapkin): initialize slug (???)
-            let _preamble = builder.preamble(&variant);
+            // Collect the slug by generating the preamble.
+            let _ = builder.preamble(&variant);
 
             match builder.slug.value_ref() {
                 None => {
@@ -125,7 +125,10 @@ impl<'a> LintDiagnosticDerive<'a> {
         let diag = &builder.diag;
         structure.gen_impl(quote! {
             gen impl<'__a> rustc_errors::DecorateLint<'__a, ()> for @Self {
-                fn decorate_lint<'__b>(self, #diag: &'__b mut rustc_errors::DiagnosticBuilder<'__a, ()>) -> &'__b mut rustc_errors::DiagnosticBuilder<'__a, ()> {
+                fn decorate_lint<'__b>(
+                    self,
+                    #diag: &'__b mut rustc_errors::DiagnosticBuilder<'__a, ()>
+                ) -> &'__b mut rustc_errors::DiagnosticBuilder<'__a, ()> {
                     use rustc_errors::IntoDiagnosticArg;
                     #implementation
                 }