Rollup merge of #75745 - jyn514:refactor-resolve, r=Manishearth

Remove duplication in `fold_item`

r? @Manishearth
This commit is contained in:
Dylan DPC 2020-08-22 02:14:47 +02:00 committed by GitHub
commit 17d60e44b0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -636,7 +636,7 @@ impl<'a, 'tcx> DocFolder for LinkCollector<'a, 'tcx> {
}
match disambiguator.map(Disambiguator::ns) {
Some(ns @ ValueNS) => {
Some(ns @ (ValueNS | 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,
&current_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 {