@@ -571,30 +571,21 @@ impl<'a, 'tcx> LinkCollector<'a, 'tcx> {
571
571
current_item : & Option < String > ,
572
572
extra_fragment : & Option < String > ,
573
573
) -> Option < Res > {
574
- let check_full_res_inner = |this : & Self , result : Result < Res , ErrorKind < ' _ > > | {
575
- let res = match result {
576
- Ok ( res) => Some ( res) ,
577
- Err ( ErrorKind :: Resolve ( box kind) ) => kind. full_res ( ) ,
578
- Err ( ErrorKind :: AnchorFailure ( AnchorFailure :: RustdocAnchorConflict ( res) ) ) => {
579
- Some ( res)
580
- }
581
- Err ( ErrorKind :: AnchorFailure ( AnchorFailure :: MultipleAnchors ) ) => None ,
582
- } ;
583
- this. kind_side_channel . take ( ) . map ( |( kind, id) | Res :: Def ( kind, id) ) . or ( res)
584
- } ;
585
- // cannot be used for macro namespace
586
- let check_full_res = |this : & Self , ns| {
587
- let result = this. resolve ( path_str, ns, current_item, module_id, extra_fragment) ;
588
- check_full_res_inner ( this, result. map ( |( res, _) | res) )
574
+ // resolve can't be used for macro namespace
575
+ let result = match ns {
576
+ Namespace :: MacroNS => self . macro_resolve ( path_str, module_id) . map_err ( ErrorKind :: from) ,
577
+ Namespace :: TypeNS | Namespace :: ValueNS => self
578
+ . resolve ( path_str, ns, current_item, module_id, extra_fragment)
579
+ . map ( |( res, _) | res) ,
589
580
} ;
590
- let check_full_res_macro = |this : & Self | {
591
- let result = this. macro_resolve ( path_str, module_id) ;
592
- check_full_res_inner ( this, result. map_err ( ErrorKind :: from) )
581
+
582
+ let res = match result {
583
+ Ok ( res) => Some ( res) ,
584
+ Err ( ErrorKind :: Resolve ( box kind) ) => kind. full_res ( ) ,
585
+ Err ( ErrorKind :: AnchorFailure ( AnchorFailure :: RustdocAnchorConflict ( res) ) ) => Some ( res) ,
586
+ Err ( ErrorKind :: AnchorFailure ( AnchorFailure :: MultipleAnchors ) ) => None ,
593
587
} ;
594
- match ns {
595
- Namespace :: MacroNS => check_full_res_macro ( self ) ,
596
- Namespace :: TypeNS | Namespace :: ValueNS => check_full_res ( self , ns) ,
597
- }
588
+ self . kind_side_channel . take ( ) . map ( |( kind, id) | Res :: Def ( kind, id) ) . or ( res)
598
589
}
599
590
}
600
591
0 commit comments