@@ -33,12 +33,9 @@ impl InherentOverlapChecker<'tcx> {
3333 }
3434
3535 for item1 in impl_items1. in_definition_order ( ) {
36- let collision = impl_items2. filter_by_name_unhygienic ( item1. ident . name ) . any ( |item2| {
37- // Symbols and namespace match, compare hygienically.
38- item1. kind . namespace ( ) == item2. kind . namespace ( )
39- && item1. ident . normalize_to_macros_2_0 ( )
40- == item2. ident . normalize_to_macros_2_0 ( )
41- } ) ;
36+ let collision = impl_items2
37+ . filter_by_name_unhygienic ( item1. ident . name )
38+ . any ( |item2| self . compare_hygienically ( item1, item2) ) ;
4239
4340 if collision {
4441 return true ;
@@ -48,6 +45,12 @@ impl InherentOverlapChecker<'tcx> {
4845 false
4946 }
5047
48+ fn compare_hygienically ( & self , item1 : & ' tcx ty:: AssocItem , item2 : & ' tcx ty:: AssocItem ) -> bool {
49+ // Symbols and namespace match, compare hygienically.
50+ item1. kind . namespace ( ) == item2. kind . namespace ( )
51+ && item1. ident . normalize_to_macros_2_0 ( ) == item2. ident . normalize_to_macros_2_0 ( )
52+ }
53+
5154 fn check_for_common_items_in_impls (
5255 & self ,
5356 impl1 : DefId ,
@@ -58,12 +61,9 @@ impl InherentOverlapChecker<'tcx> {
5861 let impl_items2 = self . tcx . associated_items ( impl2) ;
5962
6063 for item1 in impl_items1. in_definition_order ( ) {
61- let collision = impl_items2. filter_by_name_unhygienic ( item1. ident . name ) . find ( |item2| {
62- // Symbols and namespace match, compare hygienically.
63- item1. kind . namespace ( ) == item2. kind . namespace ( )
64- && item1. ident . normalize_to_macros_2_0 ( )
65- == item2. ident . normalize_to_macros_2_0 ( )
66- } ) ;
64+ let collision = impl_items2
65+ . filter_by_name_unhygienic ( item1. ident . name )
66+ . find ( |item2| self . compare_hygienically ( item1, item2) ) ;
6767
6868 if let Some ( item2) = collision {
6969 let name = item1. ident . normalize_to_macros_2_0 ( ) ;
0 commit comments