@@ -929,25 +929,23 @@ pub(super) fn check_impl_items_against_trait<'tcx>(
929
929
for impl_item in impl_items {
930
930
let ty_impl_item = tcx. associated_item ( tcx. hir ( ) . local_def_id ( impl_item. hir_id ) ) ;
931
931
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 ) ;
933
934
934
935
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 ,
943
941
} ;
944
942
945
943
// If we don't have a compatible item, we'll use the first one whose name matches
946
944
// to report an error.
947
945
let mut compatible_kind = is_compatible ( & ty_trait_item) ;
948
946
let mut trait_item = ty_trait_item;
949
947
950
- if !compatible_kind {
948
+ if !compatible_kind {
951
949
if let Some ( ty_trait_item) = items. find ( is_compatible) {
952
950
compatible_kind = true ;
953
951
trait_item = ty_trait_item;
@@ -1003,7 +1001,13 @@ pub(super) fn check_impl_items_against_trait<'tcx>(
1003
1001
impl_item,
1004
1002
) ;
1005
1003
} 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
+ ) ;
1007
1011
}
1008
1012
}
1009
1013
0 commit comments