@@ -77,7 +77,7 @@ impl<'a> DiagnosticDerive<'a> {
77
77
} ) ;
78
78
79
79
let DiagnosticDeriveKind :: Diagnostic { handler } = & builder. kind else { unreachable ! ( ) } ;
80
- # [ allow ( unused_mut ) ]
80
+
81
81
let mut imp = structure. gen_impl ( quote ! {
82
82
gen impl <' __diagnostic_handler_sess, G >
83
83
rustc_errors:: IntoDiagnostic <' __diagnostic_handler_sess, G >
@@ -95,11 +95,8 @@ impl<'a> DiagnosticDerive<'a> {
95
95
}
96
96
}
97
97
} ) ;
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) ;
103
100
}
104
101
imp
105
102
}
@@ -170,7 +167,6 @@ impl<'a> LintDiagnosticDerive<'a> {
170
167
} ) ;
171
168
172
169
let diag = & builder. diag ;
173
- #[ allow( unused_mut) ]
174
170
let mut imp = structure. gen_impl ( quote ! {
175
171
gen impl <' __a> rustc_errors:: DecorateLint <' __a, ( ) > for @Self {
176
172
#[ track_caller]
@@ -187,12 +183,10 @@ impl<'a> LintDiagnosticDerive<'a> {
187
183
}
188
184
}
189
185
} ) ;
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) ;
195
188
}
189
+
196
190
imp
197
191
}
198
192
}
@@ -223,7 +217,6 @@ impl Mismatch {
223
217
224
218
/// Generates a `#[test]` that verifies that all referenced variables
225
219
/// exist on this structure.
226
- #[ cfg( debug_assertions) ]
227
220
fn generate_test ( slug : & syn:: Path , structure : & Structure < ' _ > ) -> TokenStream {
228
221
// FIXME: We can't identify variables in a subdiagnostic
229
222
for field in structure. variants ( ) . iter ( ) . flat_map ( |v| v. ast ( ) . fields . iter ( ) ) {
0 commit comments