Skip to content

Commit a7da4b8

Browse files
committed
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.
1 parent 87d7d80 commit a7da4b8

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/librustdoc/passes/collect_intra_doc_links.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -996,7 +996,9 @@ fn preprocess_link(
996996
}
997997
};
998998

999-
if can_be_url && should_ignore_link(path_str) {
999+
// If there's no backticks, be lenient revert to old behavior.
1000+
// This is to prevent churn by linting on stuff that isn't meant to be a link.
1001+
if (can_be_url || !ori_link.link.contains('`')) && should_ignore_link(path_str) {
10001002
return None;
10011003
}
10021004

0 commit comments

Comments
 (0)