diff --git a/compiler/rustc_typeck/src/check/check.rs b/compiler/rustc_typeck/src/check/check.rs index fa630bb2b52..518090a710d 100644 --- a/compiler/rustc_typeck/src/check/check.rs +++ b/compiler/rustc_typeck/src/check/check.rs @@ -929,17 +929,15 @@ pub(super) fn check_impl_items_against_trait<'tcx>( for impl_item in impl_items { let ty_impl_item = tcx.associated_item(tcx.hir().local_def_id(impl_item.hir_id)); - let mut items = associated_items.filter_by_name(tcx, ty_impl_item.ident, impl_trait_ref.def_id); + let mut items = + associated_items.filter_by_name(tcx, ty_impl_item.ident, impl_trait_ref.def_id); let (compatible_kind, ty_trait_item) = if let Some(ty_trait_item) = items.next() { - - let is_compatible = |ty: &&ty::AssocItem| { - match (ty.kind, &impl_item.kind) { - (ty::AssocKind::Const, hir::ImplItemKind::Const(..)) => true, - (ty::AssocKind::Fn, hir::ImplItemKind::Fn(..)) => true, - (ty::AssocKind::Type, hir::ImplItemKind::TyAlias(..)) => true, - _ => false - } + let is_compatible = |ty: &&ty::AssocItem| match (ty.kind, &impl_item.kind) { + (ty::AssocKind::Const, hir::ImplItemKind::Const(..)) => true, + (ty::AssocKind::Fn, hir::ImplItemKind::Fn(..)) => true, + (ty::AssocKind::Type, hir::ImplItemKind::TyAlias(..)) => true, + _ => false, }; // If we don't have a compatible item, we'll use the first one whose name matches @@ -947,7 +945,7 @@ pub(super) fn check_impl_items_against_trait<'tcx>( let mut compatible_kind = is_compatible(&ty_trait_item); let mut trait_item = ty_trait_item; - if !compatible_kind { + if !compatible_kind { if let Some(ty_trait_item) = items.find(is_compatible) { compatible_kind = true; trait_item = ty_trait_item; @@ -1003,7 +1001,13 @@ pub(super) fn check_impl_items_against_trait<'tcx>( impl_item, ); } else { - report_mismatch_error(tcx, ty_trait_item.def_id, impl_trait_ref, impl_item, &ty_impl_item); + report_mismatch_error( + tcx, + ty_trait_item.def_id, + impl_trait_ref, + impl_item, + &ty_impl_item, + ); } }