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 comments are often written in the imperative mood #4074

Closed
lilyball opened this issue Aug 26, 2021 · 2 comments · Fixed by #4174
Closed

Doc comments are often written in the imperative mood #4074

lilyball opened this issue Aug 26, 2021 · 2 comments · Fixed by #4174
Labels
A-tokio Area: The main tokio crate C-bug Category: This is a bug. E-easy Call for participation: Experience needed to fix: Easy / not much E-help-wanted Call for participation: Help is requested to fix this issue. T-docs Topic: documentation

Comments

@lilyball
Copy link

Version
1.8.1, 1.10.1

Description
tokio's doc comments are written in a mixture of the indicative mood and imperative mood. They should all be in the indicative mood (e.g. "Returns foo"), to match the stdlib and the standard rustdoc conventions.

For example, tokio::runtime::Runtime uses the imperative mood for all of its method comments, e.g.:

pub fn handle(&self) -> &Handle
Return a handle to the runtime’s spawner.

The returned handle can be used to spawn tasks that run on this runtime, and can be cloned to allow moving the Handle to other threads.

tokio::runtime::Handle uses a mixture of imperative and indicative moods:

pub fn enter(&self) -> EnterGuard<'_>
Enter the runtime context. This allows you to construct types that must have an executor available on creation such as Sleep or TcpStream. It will also allow you to call methods such as tokio::spawn.

pub fn current() -> Self
Returns a Handle view over the currently running Runtime

Note how Handle::enter is imperative, but Handle::current is indicative (also note how Handle::current is missing the trailing period).

I mostly just look at Runtime and Handle, so I'm not sure how prevalent this issue is across the rest of the API.

@lilyball lilyball added A-tokio Area: The main tokio crate C-bug Category: This is a bug. labels Aug 26, 2021
@Darksonn Darksonn added the T-docs Topic: documentation label Aug 27, 2021
@Darksonn
Copy link
Contributor

PRs that make this type of change is fine with me. I'm sure it's very prevalent - we have not done anything to keep it consistent in this area.

@Darksonn Darksonn added E-easy Call for participation: Experience needed to fix: Easy / not much E-help-wanted Call for participation: Help is requested to fix this issue. labels Sep 19, 2021
@antglb
Copy link
Contributor

antglb commented Oct 17, 2021

I wouldn't mind working on this if no one else is.

antglb pushed a commit to antglb/tokio that referenced this issue Oct 17, 2021
Conversion of doc comments from imperative to
indicative mood. Addition of trailing periods
as well.

Fixes: tokio-rs#4074
antglb pushed a commit to antglb/tokio that referenced this issue Oct 17, 2021
Conversion of doc comments from imperative to
indicative mood. Addition of trailing periods
as well.

Fixes: tokio-rs#4074
antglb pushed a commit to antglb/tokio that referenced this issue Oct 18, 2021
Conversion of doc comments from imperative to
indicative mood. Addition of trailing periods
as well.

Fixes: tokio-rs#4074
antglb pushed a commit to antglb/tokio that referenced this issue Oct 18, 2021
Conversion of doc comments from imperative to
indicative mood. Addition of trailing periods
as well.

Fixes: tokio-rs#4074
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-tokio Area: The main tokio crate C-bug Category: This is a bug. E-easy Call for participation: Experience needed to fix: Easy / not much E-help-wanted Call for participation: Help is requested to fix this issue. T-docs Topic: documentation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants