@@ -829,16 +829,13 @@ impl<'a, 'tcx> DocFolder for LinkCollector<'a, 'tcx> {
829829 }
830830 let candidates =
831831 candidates. map ( |candidate| candidate. map ( |( res, _) | res) ) ;
832- let candidates = [ TypeNS , ValueNS , MacroNS ]
833- . iter ( )
834- . filter_map ( |& ns| candidates[ ns] . map ( |res| ( res, ns) ) ) ;
835832 ambiguity_error (
836833 cx,
837834 & item,
838835 path_str,
839836 & dox,
840837 link_range,
841- candidates. collect ( ) ,
838+ candidates. present_items ( ) . collect ( ) ,
842839 ) ;
843840 continue ;
844841 }
@@ -880,7 +877,7 @@ impl<'a, 'tcx> DocFolder for LinkCollector<'a, 'tcx> {
880877 fragment = Some ( path. to_owned ( ) ) ;
881878 } else {
882879 // `[char]` when a `char` module is in scope
883- let candidates = vec ! [ ( res, TypeNS ) , ( prim, TypeNS ) ] ;
880+ let candidates = vec ! [ res, prim] ;
884881 ambiguity_error ( cx, & item, path_str, & dox, link_range, candidates) ;
885882 continue ;
886883 }
@@ -1251,12 +1248,12 @@ fn ambiguity_error(
12511248 path_str : & str ,
12521249 dox : & str ,
12531250 link_range : Option < Range < usize > > ,
1254- candidates : Vec < ( Res , Namespace ) > ,
1251+ candidates : Vec < Res > ,
12551252) {
12561253 let mut msg = format ! ( "`{}` is " , path_str) ;
12571254
12581255 match candidates. as_slice ( ) {
1259- [ ( first_def, _ ) , ( second_def, _ ) ] => {
1256+ [ first_def, second_def] => {
12601257 msg += & format ! (
12611258 "both {} {} and {} {}" ,
12621259 first_def. article( ) ,
@@ -1267,7 +1264,7 @@ fn ambiguity_error(
12671264 }
12681265 _ => {
12691266 let mut candidates = candidates. iter ( ) . peekable ( ) ;
1270- while let Some ( ( res, _ ) ) = candidates. next ( ) {
1267+ while let Some ( res) = candidates. next ( ) {
12711268 if candidates. peek ( ) . is_some ( ) {
12721269 msg += & format ! ( "{} {}, " , res. article( ) , res. descr( ) ) ;
12731270 } else {
@@ -1284,7 +1281,7 @@ fn ambiguity_error(
12841281 diag. note ( "ambiguous link" ) ;
12851282 }
12861283
1287- for ( res, _ns ) in candidates {
1284+ for res in candidates {
12881285 let disambiguator = Disambiguator :: from_res ( res) ;
12891286 suggest_disambiguator ( disambiguator, diag, path_str, dox, sp, & link_range) ;
12901287 }
0 commit comments