Skip to content
Permalink
Browse files

little intra-doc code cleanup

  • Loading branch information
GuillaumeGomez committed Nov 24, 2019
1 parent b5f265e commit 4993807dd9416ed65b9cac0e507af34bfe04a4ad
Showing with 11 additions and 16 deletions.
  1. +11 −16 src/librustdoc/passes/collect_intra_doc_links.rs
@@ -121,23 +121,18 @@ impl<'a, 'tcx> LinkCollector<'a, 'tcx> {

// Try looking for methods and associated items.
let mut split = path_str.rsplitn(2, "::");
let item_name = if let Some(first) = split.next() {
Symbol::intern(first)
} else {
return Err(ErrorKind::ResolutionFailure)
};

let mut path = if let Some(second) = split.next() {
second.to_owned()
} else {
return Err(ErrorKind::ResolutionFailure)
};

if path == "self" || path == "Self" {
if let Some(name) = current_item.as_ref() {
path = name.clone();
let item_name = split.next()
.map(|f| Symbol::intern(f))
.ok_or(ErrorKind::ResolutionFailure)?;
let path = split.next().map(|f| {
if f == "self" || f == "Self" {
if let Some(name) = current_item.as_ref() {
return name.clone();
}
}
}
f.to_owned()
}).ok_or(ErrorKind::ResolutionFailure)?;

if let Some(prim) = is_primitive(&path, TypeNS) {
let did = primitive_impl(cx, &path).ok_or(ErrorKind::ResolutionFailure)?;
return cx.tcx.associated_items(did)

0 comments on commit 4993807

Please sign in to comment.
You can’t perform that action at this time.