Skip to content
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

doc_lazy_continuation: blank comment line for gap #13002

Merged
merged 1 commit into from
Jun 28, 2024

Conversation

notriddle
Copy link
Contributor

@notriddle notriddle commented Jun 28, 2024

This change addresses cases where doc comments are separated by blank lines, comments, or non-doc-comment attributes, like this:

/// - 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.

Fixes #12917

changelog: [`doc_lazy_continuation`]: suggest blank line for likely-unintended lazy continuations

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
@rustbot
Copy link
Collaborator

rustbot commented Jun 28, 2024

r? @Manishearth

rustbot has assigned @Manishearth.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Jun 28, 2024
@Manishearth
Copy link
Member

@bors r+

@bors
Copy link
Contributor

bors commented Jun 28, 2024

📌 Commit 6de8782 has been approved by Manishearth

It is now in the queue for this repository.

@bors
Copy link
Contributor

bors commented Jun 28, 2024

⌛ Testing commit 6de8782 with merge 2f80536...

@bors
Copy link
Contributor

bors commented Jun 28, 2024

☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test
Approved by: Manishearth
Pushing 2f80536 to master...

@bors bors merged commit 2f80536 into rust-lang:master Jun 28, 2024
8 checks passed
@notriddle notriddle deleted the notriddle/blank-line branch June 28, 2024 17:27
bors added a commit that referenced this pull request Aug 25, 2024
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Seemingly false positive of doc_lazy_continuation
4 participants