-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add new lint doc_lazy_continuation
#12770
Add new lint doc_lazy_continuation
#12770
Conversation
d0a9a7c
to
0e67032
Compare
This is a follow-up for rust-lang/rust#121659, since most cases of unintended block quotes are lazy continuations. The lint is designed to be more generally useful than that, though, because it will also catch unintended list items and unintended block quotes that didn't coincidentally hit a pulldown-cmark bug.
0e67032
to
afedaf6
Compare
/// > nest here | ||
/// > | ||
/// > > nest here | ||
/// > lazy continuation | ||
//~^ ERROR: doc quote missing `>` marker | ||
fn two() {} | ||
|
||
/// > nest here | ||
/// > | ||
/// > > nest here | ||
/// lazy continuation | ||
//~^ ERROR: doc quote missing `>` marker | ||
fn three() {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I woud argue the applicability of these (and some other similar test cases below) being MachineAppilcable
, maybe the lazy continuation
was not a quote, but the user just forgot to add a newline before it, we would never know. Putting it in a nested quote automatically might cause confusion sometimes. 🤔
Thank you for writing this lint. I am usually quite wary when introducing new style (warn by default) lints, but this one positively has my vote of confidence, even if it might lead to some churn. @bors r+ |
☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test |
This lint causes an ICE when checking fuchsia, which was discovered in the latest sync of Clippy in the CI integration test: rust-lang/rust#125202 (comment) @notriddle can you please look into this? |
Addressed by #12818 |
changelog: [
doc_lazy_continuation
]: add lint that warns on so-called "lazy paragraph continuations"This is a follow-up for rust-lang/rust#121659, since most cases of unintended block quotes are lazy continuations. The lint is designed to be more generally useful than that, though, because it will also catch unintended list items and unintended block quotes that didn't coincidentally hit a pulldown-cmark bug.
The second commit is the result of running
cargo dev dogfood --fix
, and manually fixing anything that seems wrong. NOTE: this lint's suggestions should never change the parser's interpretation of the markdown, but in many cases, it seems that doc comments in clippy were written without regard for this feature of Markdown (which, I suppose, is why this lint should exist).