@@ -26,8 +26,8 @@ impl<'hir> Item<'hir> {
26
26
Self { hir_item, renamed_name, from_glob }
27
27
}
28
28
29
- pub ( crate ) fn name ( & ' hir self ) -> & ' hir Symbol {
30
- self . renamed_name . as_ref ( ) . unwrap_or ( & self . hir_item . ident . name )
29
+ pub ( crate ) fn name ( & self ) -> Symbol {
30
+ self . renamed_name . unwrap_or ( self . hir_item . ident . name )
31
31
}
32
32
}
33
33
@@ -44,7 +44,7 @@ crate struct Module<'hir> {
44
44
/// whether the module is from a glob import
45
45
/// if `from_glob` is true and we see another module with same name,
46
46
/// then this item can be replaced with that one
47
- pub ( crate ) from_glob : bool ,
47
+ crate from_glob : bool ,
48
48
}
49
49
50
50
impl Module < ' hir > {
@@ -64,34 +64,30 @@ impl Module<'hir> {
64
64
}
65
65
66
66
pub ( crate ) fn push_item ( & mut self , new_item : Item < ' hir > ) {
67
- if let Some ( existed_item ) =
67
+ if let Some ( existing_item ) =
68
68
self . items . iter_mut ( ) . find ( |item| item. name ( ) == new_item. name ( ) )
69
69
{
70
- if existed_item. name ( ) == new_item. name ( ) {
71
- if existed_item. from_glob {
72
- debug ! ( "push_item: {:?} shadowed by {:?}" , * existed_item, new_item) ;
73
- * existed_item = new_item;
74
- return ;
75
- } else if new_item. from_glob {
76
- return ;
77
- }
70
+ if existing_item. from_glob {
71
+ debug ! ( "push_item: {:?} shadowed by {:?}" , * existing_item, new_item) ;
72
+ * existing_item = new_item;
73
+ return ;
74
+ } else if new_item. from_glob {
75
+ return ;
78
76
}
79
- } else {
80
- self . items . push ( new_item) ;
81
77
}
78
+ self . items . push ( new_item) ;
82
79
}
83
80
84
81
pub ( crate ) fn push_mod ( & mut self , new_item : Module < ' hir > ) {
85
- if let Some ( existed_mod ) = self . mods . iter_mut ( ) . find ( |mod_| mod_. name == new_item. name ) {
86
- if existed_mod . from_glob {
87
- debug ! ( "push_mod: {:?} shadowed by {:?}" , existed_mod . name, new_item. name) ;
88
- * existed_mod = new_item;
82
+ if let Some ( existing_mod ) = self . mods . iter_mut ( ) . find ( |mod_| mod_. name == new_item. name ) {
83
+ if existing_mod . from_glob {
84
+ debug ! ( "push_mod: {:?} shadowed by {:?}" , existing_mod . name, new_item. name) ;
85
+ * existing_mod = new_item;
89
86
return ;
90
87
} else if new_item. from_glob {
91
88
return ;
92
89
}
93
- } else {
94
- self . mods . push ( new_item) ;
95
90
}
91
+ self . mods . push ( new_item) ;
96
92
}
97
93
}
0 commit comments