about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbinarycat <binarycat@envs.net>2025-04-18 15:32:56 -0500
committerbinarycat <binarycat@envs.net>2025-07-24 11:17:14 -0500
commita7da4b829d328f129e342917908b70c5f4b98abc (patch)
tree9788ae28b8f03568d6eb93f7a09da9891aecb859
parent87d7d80cec060690c9055fa93cb29dfe5eb79ce9 (diff)
downloadrust-a7da4b829d328f129e342917908b70c5f4b98abc.tar.gz
rust-a7da4b829d328f129e342917908b70c5f4b98abc.zip
rustdoc::broken_intra_doc_links: no backticks = use old behavior
this is in an effort to reduce the amount of code churn caused by
this lint triggering on text that was never meant to be a link.

a more principled hierustic for ignoring lints is not possible
without extensive changes, due to the lint emitting code
being so far away from the link collecting code,
and the fact that only the link collecting code
has access to details about how the link appears in the
unnormalized markdown.
-rw-r--r--src/librustdoc/passes/collect_intra_doc_links.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/librustdoc/passes/collect_intra_doc_links.rs b/src/librustdoc/passes/collect_intra_doc_links.rs
index 97f8a2be10b..08f0d4015fc 100644
--- a/src/librustdoc/passes/collect_intra_doc_links.rs
+++ b/src/librustdoc/passes/collect_intra_doc_links.rs
@@ -996,7 +996,9 @@ fn preprocess_link(
         }
     };
 
-    if can_be_url && should_ignore_link(path_str) {
+    // If there's no backticks, be lenient revert to old behavior.
+    // This is to prevent churn by linting on stuff that isn't meant to be a link.
+    if (can_be_url || !ori_link.link.contains('`')) && should_ignore_link(path_str) {
         return None;
     }