-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Seemingly false positive of doc_lazy_continuation
#12917
Comments
What's happening here is doc comments are converted to /// This is a constant.
///
/// The meaning of which should not be explained.
const A: i32 = 42;
/// This is another constant, no longer used.
///
/// This block of documentation has a long
/// explanation and derivation to explain
/// why it is what it is, and how it's used.
///
/// It is left here for historical reasons, and
/// for reference.
///
/// Reasons it's great:
/// - First reason
/// - Second reason
/// This is yet another constant.
///
/// This has a similar fate as `B`.
///
/// Reasons it's useful:
/// 1. First reason
/// 2. Second reason
/// This is still in use.
const D: i32 = 20; But the output is confusing, we should probably have a lint for this behaviour since it's unexpected and suppress the other doc lints when it triggers |
That would be at the cost of occasional false negatives, right? |
If we make it so that they're only suppressed when the lint is actually shown we should be good, that way you receive the other lints again after either fixing or |
False negatives are massively preferable to false positives. Clippy has 433 false-positive issues open and only 72 false-negatives about now. It should be the other way around. |
Few false negatives are reported because they're hard to notice and/or just considered part of the territory of a linter, that is despite there being an essentially never ending amount of them. But why comment that here? Obviously we know false positives are not good |
This change addresses cases where doc comments are separated by blank lines, comments, or non-doc-comment attributes, like this: ```rust /// - first line // not part of doc comment /// second line ``` Before this commit, Clippy gave a pedantically-correct warning about how you needed to indent the second line. This is unlikely to be what the user intends, and has been described as a "false positive" (since Clippy is warning you about a highly unintuitive behavior that Rustdoc actually has, we definitely want it to output *something*, but the suggestion to indent was poor). rust-lang#12917
This change addresses cases where doc comments are separated by blank lines, comments, or non-doc-comment attributes, like this: ```rust /// - first line // not part of doc comment /// second line ``` Before this commit, Clippy gave a pedantically-correct warning about how you needed to indent the second line. This is unlikely to be what the user intends, and has been described as a "false positive" (since Clippy is warning you about a highly unintuitive behavior that Rustdoc actually has, we definitely want it to output *something*, but the suggestion to indent was poor). rust-lang#12917
This change addresses cases where doc comments are separated by blank lines, comments, or non-doc-comment attributes, like this: ```rust /// - first line // not part of doc comment /// second line ``` Before this commit, Clippy gave a pedantically-correct warning about how you needed to indent the second line. This is unlikely to be what the user intends, and has been described as a "false positive" (since Clippy is warning you about a highly unintuitive behavior that Rustdoc actually has, we definitely want it to output *something*, but the suggestion to indent was poor). rust-lang#12917
Rewrite `empty_line_after_doc_comments` and `empty_line_after_outer_attr`, move them from `nursery` to `suspicious` changelog: [`empty_line_after_doc_comments`], [`empty_line_after_outer_attr`]: rewrite and move them from `nursery` to `suspicious` They now lint when there's a comment between the last attr/doc comment and the empty line, to cover the case: ```rust /// Docs for `old_code // fn old_code() {} fn new_code() {} ``` When these lints or `suspicious_doc_comments` trigger we no longer trigger any other doc lint as a broad fix for #12917, reverts some of #13002 as the empty line lints cover it I ended up not doing #12917 (comment) as I don't think it's needed
Summary
We started getting these lints here: https://github.com/ruffle-rs/ruffle/actions/runs/9463299965/job/26068182584#step:6:1150
The actual piece of code: https://github.com/ruffle-rs/ruffle/blob/2b17b6ce20591b958b879e27182ad5d0c5712084/core/src/avm2/globals/flash/display/graphics.rs#L416-L482
Instinctively I don't see anything wrong with it, and it looks like the
///
and//
blocks, separated by empty lines, are conflated in various ways by different tools.Lint Name
doc_lazy_continuation
Reproducer
I tried this code:
I saw this happen:
I expected to see this happen:
Somehow these warnings don't seem right when looking at the code snippet with human eyes.
Version
Additional Labels
No response
The text was updated successfully, but these errors were encountered: