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

rustdoc: add doc comment to DocVisitor #130537

Merged
merged 1 commit into from
Sep 29, 2024

Conversation

lolbinarycat
Copy link
Contributor

No description provided.

@rustbot
Copy link
Collaborator

rustbot commented Sep 18, 2024

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @GuillaumeGomez (or someone else) some time within the next two weeks.

Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (S-waiting-on-review and S-waiting-on-author) stays updated, invoking these commands when appropriate:

  • @rustbot author: the review is finished, PR author should check the comments and take action accordingly
  • @rustbot review: the author is ready for a review, this PR will be queued again in the reviewer's queue

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels Sep 18, 2024
@@ -1,5 +1,11 @@
use crate::clean::*;

/// allows a type to traverse the cleaned as of a crate.
Copy link
Member

Choose a reason for hiding this comment

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

Nit:

Suggested change
/// allows a type to traverse the cleaned as of a crate.
/// Allows a type to traverse the cleaned AST of a crate.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

you want me to capitalize this sentence specifically? and not any of the other doc comments?

i was just matching the style of the existing comments.

Copy link
Member

@jieyouxu jieyouxu Sep 19, 2024

Choose a reason for hiding this comment

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

Sorry ignore the capitalization if it's pre-existing, just the as -> AST

Copy link
Contributor Author

Choose a reason for hiding this comment

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

will do!

@lolbinarycat lolbinarycat added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Sep 19, 2024
@bors
Copy link
Contributor

bors commented Sep 27, 2024

☔ The latest upstream changes (presumably #130857) made this pull request unmergeable. Please resolve the merge conflicts.

@lolbinarycat lolbinarycat force-pushed the rustdoc-DocVisitor-docs branch from dc9c4ad to 8aa6dd6 Compare September 27, 2024 16:36
/// note that like [`rustc_ast::visit::Visitor`], but
/// unlike [`rustc_lint::EarlyLintPass`], if you override a
/// `visit_*` method, you will need to manually recurse into
/// its contents.
Copy link
Member

Choose a reason for hiding this comment

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

content is never plural iirc

Copy link
Contributor Author

Choose a reason for hiding this comment

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

"contents" is definitely a word, it implies there is likely to be more than one thing contained.

eg. table of contents

Copy link
Member

Choose a reason for hiding this comment

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

@@ -1,5 +1,11 @@
use crate::clean::*;

/// allows a type to traverse the cleaned ast of a crate.
Copy link
Member

Choose a reason for hiding this comment

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

Missing capitalized letter.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

Please do it. Comments should be capitalized.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is that an official policy? checking the rustc dev guide, the std dev guide, and the api docs conventions rfc, there's no comment on capitalization preference.

currently deferring to previous approval, and the golden rule of code formatting (match the existing formatting of the file you're editing).

Copy link
Member

Choose a reason for hiding this comment

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

And you'll see across the files that both styles are there. So please use the one with capital and even send a PR to fix the rest if you want.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

the current file (visit.rs) only uses lowercase. this is mainly because a lot of its doc comments are not full sentences.

in our postmodern english, capitalizing a sentence fragment is arguably worse than not capitalizing a full sentence. to make these docs fully idiomatic, i would need to rephrase all the sentence fragments into full sentences, which isn't trivial.

really, the comments on the trait methods could be more helpful, but i don't have the expertise to fully explain their purpose.

perfect is the enemy of good.

Copy link
Member

Choose a reason for hiding this comment

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

You realize that doing what I'm asking would have allowed this PR to have been merged a lot earlier, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It probably could've been merged faster if you were less insistent on enforcing non-existent style guide rules, but if you really care that much, i guess i can capitalize it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

honestly there probably should be at least a suggestion to use proper capitalization, expecially for official documentation.

enforcing an unwritten rule still feels pretty bad.

Copy link
Member

Choose a reason for hiding this comment

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

I'm used to have sentences start with a capital letter and end with a dot. The only cases where I don't enforce it is on big PRs where the comments are finally just a small part of and I don't want to slow the merge.

@@ -1,5 +1,11 @@
use crate::clean::*;

/// allows a type to traverse the cleaned ast of a crate.
///
/// note that like [`rustc_ast::visit::Visitor`], but
Copy link
Member

Choose a reason for hiding this comment

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

Missing capitalized letter.

@@ -58,6 +64,7 @@ pub(crate) trait DocVisitor<'a>: Sized {
m.items.iter().for_each(|i| self.visit_item(i))
}

/// the main entrypoint of [`DocVisitor`].
Copy link
Member

Choose a reason for hiding this comment

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

Missing capital here too.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

intentional stylistic choice to match existing doc comments.

@lolbinarycat lolbinarycat force-pushed the rustdoc-DocVisitor-docs branch from 8aa6dd6 to 5ef63ec Compare September 28, 2024 23:23
@GuillaumeGomez
Copy link
Member

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Sep 29, 2024

📌 Commit 5ef63ec has been approved by GuillaumeGomez

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Sep 29, 2024
bors added a commit to rust-lang-ci/rust that referenced this pull request Sep 29, 2024
…llaumeGomez

Rollup of 5 pull requests

Successful merges:

 - rust-lang#130383 (check if it's rust-lang/rust CI job in `llvm::is_ci_llvm_modified`)
 - rust-lang#130416 (resolve rust-lang#130122: reword 'sort-by' edge-conditions documentation)
 - rust-lang#130537 (rustdoc: add doc comment to DocVisitor)
 - rust-lang#130743 (Clarifications for set_nonblocking methods)
 - rust-lang#131010 (extend comment in global_llvm_features regarding target-cpu=native)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit ed5d779 into rust-lang:master Sep 29, 2024
6 checks passed
@rustbot rustbot added this to the 1.83.0 milestone Sep 29, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Sep 29, 2024
Rollup merge of rust-lang#130537 - lolbinarycat:rustdoc-DocVisitor-docs, r=GuillaumeGomez

rustdoc: add doc comment to DocVisitor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants