Skip to content

Commit 4993807

Browse files
little intra-doc code cleanup
1 parent b5f265e commit 4993807

File tree

1 file changed

+11
-16
lines changed

1 file changed

+11
-16
lines changed

src/librustdoc/passes/collect_intra_doc_links.rs

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -121,23 +121,18 @@ impl<'a, 'tcx> LinkCollector<'a, 'tcx> {
121121

122122
// Try looking for methods and associated items.
123123
let mut split = path_str.rsplitn(2, "::");
124-
let item_name = if let Some(first) = split.next() {
125-
Symbol::intern(first)
126-
} else {
127-
return Err(ErrorKind::ResolutionFailure)
128-
};
129-
130-
let mut path = if let Some(second) = split.next() {
131-
second.to_owned()
132-
} else {
133-
return Err(ErrorKind::ResolutionFailure)
134-
};
135-
136-
if path == "self" || path == "Self" {
137-
if let Some(name) = current_item.as_ref() {
138-
path = name.clone();
124+
let item_name = split.next()
125+
.map(|f| Symbol::intern(f))
126+
.ok_or(ErrorKind::ResolutionFailure)?;
127+
let path = split.next().map(|f| {
128+
if f == "self" || f == "Self" {
129+
if let Some(name) = current_item.as_ref() {
130+
return name.clone();
131+
}
139132
}
140-
}
133+
f.to_owned()
134+
}).ok_or(ErrorKind::ResolutionFailure)?;
135+
141136
if let Some(prim) = is_primitive(&path, TypeNS) {
142137
let did = primitive_impl(cx, &path).ok_or(ErrorKind::ResolutionFailure)?;
143138
return cx.tcx.associated_items(did)

0 commit comments

Comments
 (0)