@@ -77,7 +77,7 @@ impl<'a> DiagnosticDerive<'a> {
7777 } ) ;
7878
7979 let DiagnosticDeriveKind :: Diagnostic { handler } = & builder. kind else { unreachable ! ( ) } ;
80- # [ allow ( unused_mut ) ]
80+
8181 let mut imp = structure. gen_impl ( quote ! {
8282 gen impl <' __diagnostic_handler_sess, G >
8383 rustc_errors:: IntoDiagnostic <' __diagnostic_handler_sess, G >
@@ -95,11 +95,8 @@ impl<'a> DiagnosticDerive<'a> {
9595 }
9696 }
9797 } ) ;
98- #[ cfg( debug_assertions) ]
99- {
100- for test in slugs. borrow ( ) . iter ( ) . map ( |s| generate_test ( s, & structure) ) {
101- imp. extend ( test) ;
102- }
98+ for test in slugs. borrow ( ) . iter ( ) . map ( |s| generate_test ( s, & structure) ) {
99+ imp. extend ( test) ;
103100 }
104101 imp
105102 }
@@ -170,7 +167,6 @@ impl<'a> LintDiagnosticDerive<'a> {
170167 } ) ;
171168
172169 let diag = & builder. diag ;
173- #[ allow( unused_mut) ]
174170 let mut imp = structure. gen_impl ( quote ! {
175171 gen impl <' __a> rustc_errors:: DecorateLint <' __a, ( ) > for @Self {
176172 #[ track_caller]
@@ -187,12 +183,10 @@ impl<'a> LintDiagnosticDerive<'a> {
187183 }
188184 }
189185 } ) ;
190- #[ cfg( debug_assertions) ]
191- {
192- for test in slugs. borrow ( ) . iter ( ) . map ( |s| generate_test ( s, & structure) ) {
193- imp. extend ( test) ;
194- }
186+ for test in slugs. borrow ( ) . iter ( ) . map ( |s| generate_test ( s, & structure) ) {
187+ imp. extend ( test) ;
195188 }
189+
196190 imp
197191 }
198192}
@@ -223,7 +217,6 @@ impl Mismatch {
223217
224218/// Generates a `#[test]` that verifies that all referenced variables
225219/// exist on this structure.
226- #[ cfg( debug_assertions) ]
227220fn generate_test ( slug : & syn:: Path , structure : & Structure < ' _ > ) -> TokenStream {
228221 // FIXME: We can't identify variables in a subdiagnostic
229222 for field in structure. variants ( ) . iter ( ) . flat_map ( |v| v. ast ( ) . fields . iter ( ) ) {
0 commit comments