@@ -220,7 +220,7 @@ impl<'parent, 'a> SubdiagnosticDeriveVariantBuilder<'parent, 'a> {
220
220
}
221
221
222
222
/// Generates the code for a field with no attributes.
223
- fn generate_field_arg ( & mut self , binding_info : & BindingInfo < ' _ > ) -> ( TokenStream , TokenStream ) {
223
+ fn generate_field_arg ( & mut self , binding_info : & BindingInfo < ' _ > ) -> TokenStream {
224
224
let diag = & self . parent . diag ;
225
225
226
226
let field = binding_info. ast ( ) ;
@@ -230,16 +230,12 @@ impl<'parent, 'a> SubdiagnosticDeriveVariantBuilder<'parent, 'a> {
230
230
let ident = field. ident . as_ref ( ) . unwrap ( ) ;
231
231
let ident = format_ident ! ( "{}" , ident) ; // strip `r#` prefix, if present
232
232
233
- let args = quote ! {
233
+ quote ! {
234
234
#diag. arg(
235
235
stringify!( #ident) ,
236
236
#field_binding
237
237
) ;
238
- } ;
239
- let remove_args = quote ! {
240
- #diag. remove_arg( stringify!( #ident) ) ;
241
- } ;
242
- ( args, remove_args)
238
+ }
243
239
}
244
240
245
241
/// Generates the necessary code for all attributes on a field.
@@ -610,7 +606,7 @@ impl<'parent, 'a> SubdiagnosticDeriveVariantBuilder<'parent, 'a> {
610
606
let restore_args = quote ! {
611
607
#diag. restore_args( ) ;
612
608
} ;
613
- let ( plain_args, remove_args ) : ( TokenStream , TokenStream ) = self
609
+ let plain_args: TokenStream = self
614
610
. variant
615
611
. bindings ( )
616
612
. iter ( )
@@ -623,9 +619,8 @@ impl<'parent, 'a> SubdiagnosticDeriveVariantBuilder<'parent, 'a> {
623
619
// For #[derive(Subdiagnostic)]
624
620
//
625
621
// - Store args of the main diagnostic for later restore.
626
- // - add args of subdiagnostic.
622
+ // - Add args of subdiagnostic.
627
623
// - Generate the calls, such as note, label, etc.
628
- // - Remove the arguments for allowing Vec<Subdiagnostic> to be used.
629
624
// - Restore the arguments for allowing main and subdiagnostic share the same fields.
630
625
Ok ( quote ! {
631
626
#init
@@ -634,7 +629,6 @@ impl<'parent, 'a> SubdiagnosticDeriveVariantBuilder<'parent, 'a> {
634
629
#store_args
635
630
#plain_args
636
631
#calls
637
- #remove_args
638
632
#restore_args
639
633
} )
640
634
}
0 commit comments