Add new rustdoc broken_footnote lint#137803
Add new rustdoc broken_footnote lint#137803GuillaumeGomez wants to merge 2 commits intorust-lang:mainfrom
broken_footnote lint#137803Conversation
I think you might have misunderstood the issue description. "The term of what is meant by anchors is borrowed from" a description of this style of anchor links. It doesn't say anything about footnotes. /// Consider [panics](std::alloc::GlobalAllocator#Panics) on allocation.
// ^^^^^^^ anchor |
|
I indeed misunderstood and went on a completely different path. Although I still think that this PR is useful. I plan to send a follow-up PR for unused footnote references as well. ^^' I removed the "fixes" mention though. |
|
This lint seems too noisy to belong in core. Review case F1 of #121659 (comment), where [^a-zA-Z0-9] is syntactically valid as a footnote reference, but not intended to be parsed as one. Following the suggestion (to add If the goal of this lint is to catch typo-ed footnotes, then there should be an unused footnote definition, somewhere, that the author tried and failed to reference. Those are guaranteed to be a problem: either they typo-ed the reference, or they never intended a footnote at all (but still got one). |
|
That's why we suggest to escape the |
Doing that makes the doc comment less plain-text (noisier). |
c9627d0 to
9976037
Compare
|
After discussing with @notriddle, it was decided to move the implementation of this lint into its own file. |
This comment has been minimized.
This comment has been minimized.
9976037 to
8f7f71c
Compare
|
☔ The latest upstream changes (presumably #140726) made this pull request unmergeable. Please resolve the merge conflicts. |
changelog: [`doc_suspicious_footnotes`]: lint for text that looks like a footnote reference but has no definition This is an alternative to rust-lang/rust#137803, meant to address the concerns about false positives. This lint only fires when the apparent footnote reference has a name that's made from pure ASCII digits. This choice is justified by running lintcheck on the top 200 crates, plus the clippy default set: 1. [I ran lintcheck](https://gist.github.com/notriddle/59072476c9c1fd569fee421270dad665) with a modded version of this lint that didn't check for digits only. It produced a false positive warning on a line in mdbook that had a regex, and no true positives at all. 2. [I also ran lintcheck](https://gist.github.com/notriddle/74eb8c9e1939b9f5c5549bf1d4fa238a) with a custom lint that fired on any valid footnote reference with a non-ascii-digit name. `cargo` uses one in its job_queue module, and that's all it found. cc @GuillaumeGomez
I think in this case, instead of spawning
unpportable_markdown, we should instead notify that this footnote reference doesn't have an associated definition.r? @notriddle