@@ -99,7 +99,7 @@ impl ImportDirective {
9999 }
100100}
101101
102- #[ derive( Clone , Copy ) ]
102+ #[ derive( Clone , Default ) ]
103103/// Records information about the resolution of a name in a module.
104104pub struct NameResolution < ' a > {
105105 /// The number of unresolved single imports that could define the name.
@@ -108,12 +108,6 @@ pub struct NameResolution<'a> {
108108 pub binding : Option < & ' a NameBinding < ' a > > ,
109109}
110110
111- impl < ' a > Default for NameResolution < ' a > {
112- fn default ( ) -> Self {
113- NameResolution { outstanding_references : 0 , binding : None }
114- }
115- }
116-
117111impl < ' a > NameResolution < ' a > {
118112 pub fn result ( & self , outstanding_globs : usize ) -> ResolveResult < & ' a NameBinding < ' a > > {
119113 // If no unresolved imports (single or glob) can define the name, self.binding is final.
@@ -137,8 +131,8 @@ impl<'a> NameResolution<'a> {
137131 pub fn try_define ( & mut self , binding : & ' a NameBinding < ' a > ) -> Result < ( ) , & ' a NameBinding < ' a > > {
138132 let is_prelude = |binding : & NameBinding | binding. defined_with ( DefModifiers :: PRELUDE ) ;
139133 let old_binding = match self . binding {
140- Some ( old_binding ) if is_prelude ( binding) && ! is_prelude ( old_binding ) => return Ok ( ( ) ) ,
141- Some ( old_binding) if is_prelude ( old_binding) == is_prelude ( binding ) => old_binding,
134+ Some ( _ ) if is_prelude ( binding) => return Ok ( ( ) ) ,
135+ Some ( old_binding) if ! is_prelude ( old_binding) => old_binding,
142136 _ => { self . binding = Some ( binding) ; return Ok ( ( ) ) ; }
143137 } ;
144138
0 commit comments