diff --git a/compiler/rustc_resolve/src/rustdoc.rs b/compiler/rustc_resolve/src/rustdoc.rs index f7275bed59c..cbda0535c89 100644 --- a/compiler/rustc_resolve/src/rustdoc.rs +++ b/compiler/rustc_resolve/src/rustdoc.rs @@ -410,7 +410,14 @@ fn parse_links<'md>(doc: &'md str) -> Vec> { while let Some(event) = event_iter.next() { match event { Event::Start(Tag::Link(link_type, dest, _)) if may_be_doc_link(link_type) => { - if matches!(link_type, LinkType::Inline | LinkType::ReferenceUnknown | LinkType::Reference) { + if matches!( + link_type, + LinkType::Inline + | LinkType::ReferenceUnknown + | LinkType::Reference + | LinkType::Shortcut + | LinkType::ShortcutUnknown + ) { if let Some(display_text) = collect_link_data(&mut event_iter) { links.push(display_text); } diff --git a/src/librustdoc/passes/lint/redundant_explicit_links.rs b/src/librustdoc/passes/lint/redundant_explicit_links.rs index da8a73be60b..a41e278fd81 100644 --- a/src/librustdoc/passes/lint/redundant_explicit_links.rs +++ b/src/librustdoc/passes/lint/redundant_explicit_links.rs @@ -34,7 +34,7 @@ pub(crate) fn visit_item(cx: &DocContext<'_>, item: &Item) { if item.link_names(&cx.cache).is_empty() { // If there's no link names in this item, - // then we skip resolution querying to + // then we skip resolution querying to // avoid from panicking. return; } @@ -80,7 +80,8 @@ fn check_redundant_explicit_link<'md>( if (explicit_len >= display_len && &explicit_link[(explicit_len - display_len)..] == display_link) || (display_len >= explicit_len - && &display_link[(display_len - explicit_len)..] == explicit_link) { + && &display_link[(display_len - explicit_len)..] == explicit_link) + { match link_type { LinkType::Inline | LinkType::ReferenceUnknown => { check_inline_or_reference_unknown_redundancy( @@ -92,7 +93,11 @@ fn check_redundant_explicit_link<'md>( link_range, dest.to_string(), link_data, - if link_type == LinkType::Inline { (b'(', b')') } else { (b'[', b']') }, + if link_type == LinkType::Inline { + (b'(', b')') + } else { + (b'[', b']') + }, ); } LinkType::Reference => { @@ -110,7 +115,7 @@ fn check_redundant_explicit_link<'md>( _ => {} } } - }, + } _ => {} } }