@@ -1065,45 +1065,46 @@ fn clean_trait_item<'tcx>(trait_item: &hir::TraitItem<'tcx>, cx: &mut DocContext
1065
1065
} )
1066
1066
}
1067
1067
1068
- impl < ' tcx > Clean < ' tcx , Item > for hir:: ImplItem < ' tcx > {
1069
- fn clean ( & self , cx : & mut DocContext < ' tcx > ) -> Item {
1070
- let local_did = self . def_id . to_def_id ( ) ;
1071
- cx. with_param_env ( local_did, |cx| {
1072
- let inner = match self . kind {
1073
- hir:: ImplItemKind :: Const ( ty, expr) => {
1074
- let default = ConstantKind :: Local { def_id : local_did, body : expr } ;
1075
- AssocConstItem ( clean_ty ( ty, cx) , default)
1076
- }
1077
- hir:: ImplItemKind :: Fn ( ref sig, body) => {
1078
- let m = clean_function ( cx, sig, self . generics , body) ;
1079
- let defaultness = cx. tcx . impl_defaultness ( self . def_id ) ;
1080
- MethodItem ( m, Some ( defaultness) )
1081
- }
1082
- hir:: ImplItemKind :: TyAlias ( hir_ty) => {
1083
- let type_ = clean_ty ( hir_ty, cx) ;
1084
- let generics = self . generics . clean ( cx) ;
1085
- let item_type = clean_middle_ty ( hir_ty_to_ty ( cx. tcx , hir_ty) , cx, None ) ;
1086
- AssocTypeItem (
1087
- Box :: new ( Typedef { type_, generics, item_type : Some ( item_type) } ) ,
1088
- Vec :: new ( ) ,
1089
- )
1090
- }
1091
- } ;
1068
+ pub ( crate ) fn clean_impl_item < ' tcx > (
1069
+ impl_ : & hir:: ImplItem < ' tcx > ,
1070
+ cx : & mut DocContext < ' tcx > ,
1071
+ ) -> Item {
1072
+ let local_did = impl_. def_id . to_def_id ( ) ;
1073
+ cx. with_param_env ( local_did, |cx| {
1074
+ let inner = match impl_. kind {
1075
+ hir:: ImplItemKind :: Const ( ty, expr) => {
1076
+ let default = ConstantKind :: Local { def_id : local_did, body : expr } ;
1077
+ AssocConstItem ( clean_ty ( ty, cx) , default)
1078
+ }
1079
+ hir:: ImplItemKind :: Fn ( ref sig, body) => {
1080
+ let m = clean_function ( cx, sig, impl_. generics , body) ;
1081
+ let defaultness = cx. tcx . impl_defaultness ( impl_. def_id ) ;
1082
+ MethodItem ( m, Some ( defaultness) )
1083
+ }
1084
+ hir:: ImplItemKind :: TyAlias ( hir_ty) => {
1085
+ let type_ = clean_ty ( hir_ty, cx) ;
1086
+ let generics = impl_. generics . clean ( cx) ;
1087
+ let item_type = clean_middle_ty ( hir_ty_to_ty ( cx. tcx , hir_ty) , cx, None ) ;
1088
+ AssocTypeItem (
1089
+ Box :: new ( Typedef { type_, generics, item_type : Some ( item_type) } ) ,
1090
+ Vec :: new ( ) ,
1091
+ )
1092
+ }
1093
+ } ;
1092
1094
1093
- let mut what_rustc_thinks =
1094
- Item :: from_def_id_and_parts ( local_did, Some ( self . ident . name ) , inner, cx) ;
1095
+ let mut what_rustc_thinks =
1096
+ Item :: from_def_id_and_parts ( local_did, Some ( impl_ . ident . name ) , inner, cx) ;
1095
1097
1096
- let impl_ref = cx. tcx . impl_trait_ref ( cx. tcx . local_parent ( self . def_id ) ) ;
1098
+ let impl_ref = cx. tcx . impl_trait_ref ( cx. tcx . local_parent ( impl_ . def_id ) ) ;
1097
1099
1098
- // Trait impl items always inherit the impl's visibility --
1099
- // we don't want to show `pub`.
1100
- if impl_ref. is_some ( ) {
1101
- what_rustc_thinks. visibility = Inherited ;
1102
- }
1100
+ // Trait impl items always inherit the impl's visibility --
1101
+ // we don't want to show `pub`.
1102
+ if impl_ref. is_some ( ) {
1103
+ what_rustc_thinks. visibility = Inherited ;
1104
+ }
1103
1105
1104
- what_rustc_thinks
1105
- } )
1106
- }
1106
+ what_rustc_thinks
1107
+ } )
1107
1108
}
1108
1109
1109
1110
impl < ' tcx > Clean < ' tcx , Item > for ty:: AssocItem {
@@ -1995,8 +1996,11 @@ fn clean_impl<'tcx>(
1995
1996
let tcx = cx. tcx ;
1996
1997
let mut ret = Vec :: new ( ) ;
1997
1998
let trait_ = impl_. of_trait . as_ref ( ) . map ( |t| clean_trait_ref ( t, cx) ) ;
1998
- let items =
1999
- impl_. items . iter ( ) . map ( |ii| tcx. hir ( ) . impl_item ( ii. id ) . clean ( cx) ) . collect :: < Vec < _ > > ( ) ;
1999
+ let items = impl_
2000
+ . items
2001
+ . iter ( )
2002
+ . map ( |ii| clean_impl_item ( tcx. hir ( ) . impl_item ( ii. id ) , cx) )
2003
+ . collect :: < Vec < _ > > ( ) ;
2000
2004
let def_id = tcx. hir ( ) . local_def_id ( hir_id) ;
2001
2005
2002
2006
// If this impl block is an implementation of the Deref trait, then we
0 commit comments