From d468a81a8a62131b5b88e3ca09512b8a08895274 Mon Sep 17 00:00:00 2001 From: Joshua Nelson Date: Thu, 20 Aug 2020 11:19:11 -0400 Subject: [PATCH 1/2] Remove duplication in `fold_item` --- .../passes/collect_intra_doc_links.rs | 24 +------------------ 1 file changed, 1 insertion(+), 23 deletions(-) diff --git a/src/librustdoc/passes/collect_intra_doc_links.rs b/src/librustdoc/passes/collect_intra_doc_links.rs index 97b9fcce05b..1036d40167c 100644 --- a/src/librustdoc/passes/collect_intra_doc_links.rs +++ b/src/librustdoc/passes/collect_intra_doc_links.rs @@ -636,7 +636,7 @@ impl<'a, 'tcx> DocFolder for LinkCollector<'a, 'tcx> { } match disambiguator.map(Disambiguator::ns) { - Some(ns @ ValueNS) => { + Some(ns @ ValueNS | ns @ TypeNS) => { match self.resolve( path_str, disambiguator, @@ -660,28 +660,6 @@ impl<'a, 'tcx> DocFolder for LinkCollector<'a, 'tcx> { } } } - Some(ns @ TypeNS) => { - match self.resolve( - path_str, - disambiguator, - ns, - ¤t_item, - base_node, - &extra_fragment, - Some(&item), - ) { - Ok(res) => res, - Err(ErrorKind::ResolutionFailure) => { - resolution_failure(cx, &item, path_str, &dox, link_range); - // This could just be a normal link. - continue; - } - Err(ErrorKind::AnchorFailure(msg)) => { - anchor_failure(cx, &item, &ori_link, &dox, link_range, msg); - continue; - } - } - } None => { // Try everything! let mut candidates = PerNS { From f5d784845801f2c6ec27857f0dff865f376f2ed1 Mon Sep 17 00:00:00 2001 From: Joshua Nelson Date: Thu, 20 Aug 2020 12:15:17 -0400 Subject: [PATCH 2/2] Remove duplicate binding in match Co-authored-by: lzutao --- src/librustdoc/passes/collect_intra_doc_links.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/librustdoc/passes/collect_intra_doc_links.rs b/src/librustdoc/passes/collect_intra_doc_links.rs index 1036d40167c..9c57435a8c0 100644 --- a/src/librustdoc/passes/collect_intra_doc_links.rs +++ b/src/librustdoc/passes/collect_intra_doc_links.rs @@ -636,7 +636,7 @@ impl<'a, 'tcx> DocFolder for LinkCollector<'a, 'tcx> { } match disambiguator.map(Disambiguator::ns) { - Some(ns @ ValueNS | ns @ TypeNS) => { + Some(ns @ (ValueNS | TypeNS)) => { match self.resolve( path_str, disambiguator,