@@ -790,22 +790,23 @@ fn clean_function(
790
790
Function { decl, generics, header : sig. header }
791
791
}
792
792
793
- impl < ' a > Clean < Arguments > for ( & ' a [ hir:: Ty < ' a > ] , & ' a [ Ident ] ) {
794
- fn clean ( & self , cx : & mut DocContext < ' _ > ) -> Arguments {
795
- Arguments {
796
- values : self
797
- . 0
798
- . iter ( )
799
- . enumerate ( )
800
- . map ( |( i, ty) | {
801
- let mut name = self . 1 . get ( i) . map_or ( kw:: Empty , |ident| ident. name ) ;
802
- if name. is_empty ( ) {
803
- name = kw:: Underscore ;
804
- }
805
- Argument { name, type_ : ty. clean ( cx) , is_const : false }
806
- } )
807
- . collect ( ) ,
808
- }
793
+ fn clean_args_from_types_and_names (
794
+ cx : & mut DocContext < ' _ > ,
795
+ types : & [ hir:: Ty < ' _ > ] ,
796
+ names : & [ Ident ] ,
797
+ ) -> Arguments {
798
+ Arguments {
799
+ values : types
800
+ . iter ( )
801
+ . enumerate ( )
802
+ . map ( |( i, ty) | {
803
+ let mut name = names. get ( i) . map_or ( kw:: Empty , |ident| ident. name ) ;
804
+ if name. is_empty ( ) {
805
+ name = kw:: Underscore ;
806
+ }
807
+ Argument { name, type_ : ty. clean ( cx) , is_const : false }
808
+ } )
809
+ . collect ( ) ,
809
810
}
810
811
}
811
812
@@ -916,7 +917,7 @@ impl Clean<Item> for hir::TraitItem<'_> {
916
917
let ( generics, decl) = enter_impl_trait ( cx, |cx| {
917
918
// NOTE: generics must be cleaned before args
918
919
let generics = self . generics . clean ( cx) ;
919
- let args = ( sig. decl . inputs , names) . clean ( cx ) ;
920
+ let args = clean_args_from_types_and_names ( cx , sig. decl . inputs , names) ;
920
921
let decl = clean_fn_decl_with_args ( cx, sig. decl , args) ;
921
922
( generics, decl)
922
923
} ) ;
@@ -1714,7 +1715,7 @@ impl Clean<BareFunctionDecl> for hir::BareFnTy<'_> {
1714
1715
let ( generic_params, decl) = enter_impl_trait ( cx, |cx| {
1715
1716
// NOTE: generics must be cleaned before args
1716
1717
let generic_params = self . generic_params . iter ( ) . map ( |x| x. clean ( cx) ) . collect ( ) ;
1717
- let args = ( self . decl . inputs , self . param_names ) . clean ( cx ) ;
1718
+ let args = clean_args_from_types_and_names ( cx , self . decl . inputs , self . param_names ) ;
1718
1719
let decl = clean_fn_decl_with_args ( cx, self . decl , args) ;
1719
1720
( generic_params, decl)
1720
1721
} ) ;
@@ -2034,7 +2035,7 @@ impl Clean<Item> for (&hir::ForeignItem<'_>, Option<Symbol>) {
2034
2035
let ( generics, decl) = enter_impl_trait ( cx, |cx| {
2035
2036
// NOTE: generics must be cleaned before args
2036
2037
let generics = generics. clean ( cx) ;
2037
- let args = ( decl. inputs , names) . clean ( cx ) ;
2038
+ let args = clean_args_from_types_and_names ( cx , decl. inputs , names) ;
2038
2039
let decl = clean_fn_decl_with_args ( cx, decl, args) ;
2039
2040
( generics, decl)
2040
2041
} ) ;
0 commit comments