@@ -33,12 +33,9 @@ impl InherentOverlapChecker<'tcx> {
33
33
}
34
34
35
35
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) ) ;
42
39
43
40
if collision {
44
41
return true ;
@@ -48,6 +45,12 @@ impl InherentOverlapChecker<'tcx> {
48
45
false
49
46
}
50
47
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
+
51
54
fn check_for_common_items_in_impls (
52
55
& self ,
53
56
impl1 : DefId ,
@@ -58,12 +61,9 @@ impl InherentOverlapChecker<'tcx> {
58
61
let impl_items2 = self . tcx . associated_items ( impl2) ;
59
62
60
63
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) ) ;
67
67
68
68
if let Some ( item2) = collision {
69
69
let name = item1. ident . normalize_to_macros_2_0 ( ) ;
0 commit comments