@@ -929,25 +929,23 @@ pub(super) fn check_impl_items_against_trait<'tcx>(
929929 for impl_item in impl_items {
930930 let ty_impl_item = tcx. associated_item ( tcx. hir ( ) . local_def_id ( impl_item. hir_id ) ) ;
931931
932- let mut items = associated_items. filter_by_name ( tcx, ty_impl_item. ident , impl_trait_ref. def_id ) ;
932+ let mut items =
933+ associated_items. filter_by_name ( tcx, ty_impl_item. ident , impl_trait_ref. def_id ) ;
933934
934935 let ( compatible_kind, ty_trait_item) = if let Some ( ty_trait_item) = items. next ( ) {
935-
936- let is_compatible = |ty : & & ty:: AssocItem | {
937- match ( ty. kind , & impl_item. kind ) {
938- ( ty:: AssocKind :: Const , hir:: ImplItemKind :: Const ( ..) ) => true ,
939- ( ty:: AssocKind :: Fn , hir:: ImplItemKind :: Fn ( ..) ) => true ,
940- ( ty:: AssocKind :: Type , hir:: ImplItemKind :: TyAlias ( ..) ) => true ,
941- _ => false
942- }
936+ let is_compatible = |ty : & & ty:: AssocItem | match ( ty. kind , & impl_item. kind ) {
937+ ( ty:: AssocKind :: Const , hir:: ImplItemKind :: Const ( ..) ) => true ,
938+ ( ty:: AssocKind :: Fn , hir:: ImplItemKind :: Fn ( ..) ) => true ,
939+ ( ty:: AssocKind :: Type , hir:: ImplItemKind :: TyAlias ( ..) ) => true ,
940+ _ => false ,
943941 } ;
944942
945943 // If we don't have a compatible item, we'll use the first one whose name matches
946944 // to report an error.
947945 let mut compatible_kind = is_compatible ( & ty_trait_item) ;
948946 let mut trait_item = ty_trait_item;
949947
950- if !compatible_kind {
948+ if !compatible_kind {
951949 if let Some ( ty_trait_item) = items. find ( is_compatible) {
952950 compatible_kind = true ;
953951 trait_item = ty_trait_item;
@@ -1003,7 +1001,13 @@ pub(super) fn check_impl_items_against_trait<'tcx>(
10031001 impl_item,
10041002 ) ;
10051003 } else {
1006- report_mismatch_error ( tcx, ty_trait_item. def_id , impl_trait_ref, impl_item, & ty_impl_item) ;
1004+ report_mismatch_error (
1005+ tcx,
1006+ ty_trait_item. def_id ,
1007+ impl_trait_ref,
1008+ impl_item,
1009+ & ty_impl_item,
1010+ ) ;
10071011 }
10081012 }
10091013
0 commit comments