Skip to content

Commit f68cc68

Browse files
committed
Review feedback for collect_intra_doc_links.rs
* Add assertion value is defined. * Simplify comment. * Fix bad change in err message.
1 parent d2de69d commit f68cc68

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/librustdoc/passes/collect_intra_doc_links.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -435,8 +435,9 @@ impl<'a, 'tcx> LinkCollector<'a, 'tcx> {
435435

436436
// Try looking for methods and associated items.
437437
let mut split = path_str.rsplitn(2, "::");
438-
// NB: the `splitn`'s first element is always defined, even if the delimiter is not present.
438+
// NB: `split`'s first element is always defined, even if the delimiter was not present.
439439
let item_str = split.next().unwrap();
440+
assert!(!item_str.is_empty());
440441
let item_name = Symbol::intern(item_str);
441442
let path_root = split
442443
.next()
@@ -448,7 +449,7 @@ impl<'a, 'tcx> LinkCollector<'a, 'tcx> {
448449
ResolutionFailure::NotResolved {
449450
module_id,
450451
partial_res: None,
451-
unresolved: path_str.into(),
452+
unresolved: item_str.into(),
452453
}
453454
})?;
454455

0 commit comments

Comments
 (0)