@@ -1459,60 +1459,47 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
1459
1459
} ) ;
1460
1460
}
1461
1461
1462
- enum FindBindingResult < ' a > {
1463
- Binding ( Result < & ' a NameBinding < ' a > , Determinacy > ) ,
1464
- Res ( Res ) ,
1465
- }
1466
- let find_binding_in_ns = |this : & mut Self , ns| {
1467
- let binding = if let Some ( module) = module {
1468
- this. resolve_ident_in_module (
1469
- module,
1470
- ident,
1471
- ns,
1472
- parent_scope,
1473
- finalize,
1474
- ignore_binding,
1475
- )
1476
- } else if let Some ( ribs) = ribs
1477
- && let Some ( TypeNS | ValueNS ) = opt_ns
1478
- {
1479
- match this. resolve_ident_in_lexical_scope (
1480
- ident,
1481
- ns,
1482
- parent_scope,
1483
- finalize,
1484
- & ribs[ ns] ,
1485
- ignore_binding,
1486
- ) {
1487
- // we found a locally-imported or available item/module
1488
- Some ( LexicalScopeBinding :: Item ( binding) ) => Ok ( binding) ,
1489
- // we found a local variable or type param
1490
- Some ( LexicalScopeBinding :: Res ( res) ) => return FindBindingResult :: Res ( res) ,
1491
- _ => Err ( Determinacy :: determined ( finalize. is_some ( ) ) ) ,
1462
+ let binding = if let Some ( module) = module {
1463
+ self . resolve_ident_in_module (
1464
+ module,
1465
+ ident,
1466
+ ns,
1467
+ parent_scope,
1468
+ finalize,
1469
+ ignore_binding,
1470
+ )
1471
+ } else if let Some ( ribs) = ribs && let Some ( TypeNS | ValueNS ) = opt_ns {
1472
+ match self . resolve_ident_in_lexical_scope (
1473
+ ident,
1474
+ ns,
1475
+ parent_scope,
1476
+ finalize,
1477
+ & ribs[ ns] ,
1478
+ ignore_binding,
1479
+ ) {
1480
+ // we found a locally-imported or available item/module
1481
+ Some ( LexicalScopeBinding :: Item ( binding) ) => Ok ( binding) ,
1482
+ // we found a local variable or type param
1483
+ Some ( LexicalScopeBinding :: Res ( res) ) => {
1484
+ record_segment_res ( self , res) ;
1485
+ return PathResult :: NonModule ( PartialRes :: with_unresolved_segments (
1486
+ res,
1487
+ path. len ( ) - 1 ,
1488
+ ) ) ;
1492
1489
}
1493
- } else {
1494
- let scopes = ScopeSet :: All ( ns, opt_ns. is_none ( ) ) ;
1495
- this. early_resolve_ident_in_lexical_scope (
1496
- ident,
1497
- scopes,
1498
- parent_scope,
1499
- finalize,
1500
- finalize. is_some ( ) ,
1501
- ignore_binding,
1502
- )
1503
- } ;
1504
- FindBindingResult :: Binding ( binding)
1505
- } ;
1506
- let binding = match find_binding_in_ns ( self , ns) {
1507
- FindBindingResult :: Res ( res) => {
1508
- record_segment_res ( self , res) ;
1509
- return PathResult :: NonModule ( PartialRes :: with_unresolved_segments (
1510
- res,
1511
- path. len ( ) - 1 ,
1512
- ) ) ;
1490
+ _ => Err ( Determinacy :: determined ( finalize. is_some ( ) ) ) ,
1513
1491
}
1514
- FindBindingResult :: Binding ( binding) => binding,
1492
+ } else {
1493
+ self . early_resolve_ident_in_lexical_scope (
1494
+ ident,
1495
+ ScopeSet :: All ( ns, opt_ns. is_none ( ) ) ,
1496
+ parent_scope,
1497
+ finalize,
1498
+ finalize. is_some ( ) ,
1499
+ ignore_binding,
1500
+ )
1515
1501
} ;
1502
+
1516
1503
match binding {
1517
1504
Ok ( binding) => {
1518
1505
if segment_idx == 1 {
0 commit comments