Skip to content

Make docs more consistent #8908

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

Merged
merged 3 commits into from
Jun 2, 2022
Merged

Conversation

Serial-ATA
Copy link
Contributor

changelog: none

This just fixes some docs to make them more consistent. I mostly just changed // Good, // Bad, etc to Use instead:.

@rust-highfive
Copy link

r? @Manishearth

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label May 28, 2022
@xFrednet
Copy link
Member

I like unifying the documentation. Here we suggest using // good / // bad comments. If we use this version with Use Instead it would be good if that example would also be changed. 🙃

I have no real preference, which is better, but I believe that Use Instead is better for following changes. 👍

@Serial-ATA Serial-ATA force-pushed the doc-comment-issues branch from 70ae87a to adafb6c Compare May 28, 2022 13:51
@Manishearth
Copy link
Member

r? @xFrednet since you've already had a look 😄

Copy link
Member

@xFrednet xFrednet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As said before, I like this change, and everything looks good to me. I have one more suggestion if you don't mind. 🙃

@@ -29,7 +29,7 @@ declare_clippy_lint! {
/// if true { /* ... */ }
/// ```
///
/// // or
/// or
Copy link
Member

@xFrednet xFrednet May 31, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In cases with or we might want to consider removing the // bad comment and replacing the // good with // use instead instead. What do you think? And would you mind updating that in another commit?

Thinking about this a bit more, I think it's good to remove the "// bad" comments, as it can be seen as degrading the actual code. But I might also be over thinking this a bit too much 😅

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alternatively, we could also use multiple ### Example headlines, but I believe that that would look weird 😅

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Forgot to fix this one, I just noticed the misplaced comment 😄. I think "or" should be removed entirely and all "bad" snippets should go in the same example, and all of the "good" ones in the Use instead section:

Examples

if { true } { /* ... */ }

if { let x = somefunc(); x } { /* ... */ }

Use instead:

if true { /* ... */ }

let res = { let x = somefunc(); x };
if res { /* ... */ }

I think that's a lot cleaner, what do you think?

Copy link
Member

@xFrednet xFrednet Jun 1, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this example, I agree 👍 . There might be some cases where this could be overwhelming, though. Could you review the other "// or" cases as well? If it's the same story, then we can just remove the "// bad" comments and separate the examples into the two blocks. :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All of the other occurrences look alright if they were to be combined. It doesn't seem to be that common of a pattern, and when it's used the examples are pretty short.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perfect. Can you combine them in this PR?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. Can I replace the // Good/// Bad comments in another PR? There are too many to do at once 😄.

@Serial-ATA Serial-ATA force-pushed the doc-comment-issues branch from b95a7ae to b20f95c Compare June 1, 2022 22:53
@xFrednet
Copy link
Member

xFrednet commented Jun 2, 2022

Looks good to me, thank you for the update! 👍

@bors r+

@bors
Copy link
Contributor

bors commented Jun 2, 2022

📌 Commit b20f95c has been approved by xFrednet

@bors
Copy link
Contributor

bors commented Jun 2, 2022

⌛ Testing commit b20f95c with merge 0d5ace3...

@bors
Copy link
Contributor

bors commented Jun 2, 2022

☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test
Approved by: xFrednet
Pushing 0d5ace3 to master...

@bors bors merged commit 0d5ace3 into rust-lang:master Jun 2, 2022
@bors bors mentioned this pull request Jun 2, 2022
bors added a commit that referenced this pull request Jun 9, 2022
Improve lint doc consistency

changelog: none

This is a continuation of #8908.

Notable changes:
- Removed empty `Known Problems` sections
- Removed "Good"/"Bad" language (replaced with "Use instead")
- Removed (and added some 😄) duplication
- Ignored the [`create_dir`] example so it doesn't create `clippy_lints/foo` 😄
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.

5 participants