@@ -141,26 +141,20 @@ impl<'a> NameResolution<'a> {
141
141
Ok ( ( ) )
142
142
}
143
143
144
- // Returns the resolution of the name assuming no more globs will define it.
145
- fn result ( & self , allow_private_imports : bool ) -> ResolveResult < & ' a NameBinding < ' a > > {
146
- match self . binding {
147
- Some ( binding) if !binding. defined_with ( DefModifiers :: GLOB_IMPORTED ) => Success ( binding) ,
148
- // If we don't allow private imports and no public imports can define the name, fail.
149
- _ if !allow_private_imports && self . pub_outstanding_references == 0 &&
150
- !self . binding . map ( NameBinding :: is_public) . unwrap_or ( false ) => Failed ( None ) ,
151
- _ if self . outstanding_references > 0 => Indeterminate ,
152
- Some ( binding) => Success ( binding) ,
153
- None => Failed ( None ) ,
154
- }
155
- }
156
-
157
144
// Returns Some(the resolution of the name), or None if the resolution depends
158
145
// on whether more globs can define the name.
159
146
fn try_result ( & self , allow_private_imports : bool )
160
147
-> Option < ResolveResult < & ' a NameBinding < ' a > > > {
161
- match self . result ( allow_private_imports) {
162
- Failed ( _) => None ,
163
- result @ _ => Some ( result) ,
148
+ match self . binding {
149
+ Some ( binding) if !binding. defined_with ( DefModifiers :: GLOB_IMPORTED ) =>
150
+ Some ( Success ( binding) ) ,
151
+ // If (1) we don't allow private imports, (2) no public single import can define the
152
+ // name, and (3) no public glob has defined the name, the resolution depends on globs.
153
+ _ if !allow_private_imports && self . pub_outstanding_references == 0 &&
154
+ !self . binding . map ( NameBinding :: is_public) . unwrap_or ( false ) => None ,
155
+ _ if self . outstanding_references > 0 => Some ( Indeterminate ) ,
156
+ Some ( binding) => Some ( Success ( binding) ) ,
157
+ None => None ,
164
158
}
165
159
}
166
160
0 commit comments