Skip to content

Commit bdad4f8

Browse files
committed
Make item for resolve mandatory
1 parent 1c678f4 commit bdad4f8

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

src/librustdoc/passes/collect_intra_doc_links.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ impl<'a, 'tcx> LinkCollector<'a, 'tcx> {
169169
current_item: &Option<String>,
170170
parent_id: Option<DefId>,
171171
extra_fragment: &Option<String>,
172-
item_opt: Option<&Item>,
172+
item: &Item,
173173
) -> Result<(Res, Option<String>), ErrorKind> {
174174
let cx = self.cx;
175175

@@ -333,8 +333,7 @@ impl<'a, 'tcx> LinkCollector<'a, 'tcx> {
333333
// TODO: give a warning if this is ambiguous
334334
.next();
335335
// TODO: is this necessary? It doesn't look right, and also only works for local items
336-
let trait_kind = item_opt
337-
.and_then(|item| self.cx.as_local_hir_id(item.def_id))
336+
let trait_kind = self.cx.as_local_hir_id(item.def_id)
338337
.and_then(|item_hir| {
339338
// Checks if item_name belongs to `impl SomeTrait for SomeItem`
340339
let parent_hir = self.cx.tcx.hir().get_parent_item(item_hir);
@@ -703,7 +702,7 @@ impl<'a, 'tcx> DocFolder for LinkCollector<'a, 'tcx> {
703702
&current_item,
704703
base_node,
705704
&extra_fragment,
706-
Some(&item),
705+
&item,
707706
) {
708707
Ok(res) => res,
709708
Err(ErrorKind::ResolutionFailure) => {
@@ -727,7 +726,7 @@ impl<'a, 'tcx> DocFolder for LinkCollector<'a, 'tcx> {
727726
&current_item,
728727
base_node,
729728
&extra_fragment,
730-
Some(&item),
729+
&item,
731730
) {
732731
Ok(res) => res,
733732
Err(ErrorKind::ResolutionFailure) => {
@@ -754,7 +753,7 @@ impl<'a, 'tcx> DocFolder for LinkCollector<'a, 'tcx> {
754753
&current_item,
755754
base_node,
756755
&extra_fragment,
757-
Some(&item),
756+
&item,
758757
) {
759758
Err(ErrorKind::AnchorFailure(msg)) => {
760759
anchor_failure(cx, &item, &ori_link, &dox, link_range, msg);
@@ -769,7 +768,7 @@ impl<'a, 'tcx> DocFolder for LinkCollector<'a, 'tcx> {
769768
&current_item,
770769
base_node,
771770
&extra_fragment,
772-
Some(&item),
771+
&item,
773772
) {
774773
Err(ErrorKind::AnchorFailure(msg)) => {
775774
anchor_failure(cx, &item, &ori_link, &dox, link_range, msg);

0 commit comments

Comments
 (0)