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

Add lint for pub fns returning a Result without documenting errors #4884

Merged
merged 1 commit into from
Dec 6, 2019

Conversation

RobbieClarken
Copy link
Contributor

The Rust Book recommends that functions that return a Result type have a doc comment with an # Errors section describing the kind of errors that can be returned. This change adds a lint to enforce this. The lint is allow by default; it can be enabled with #![warn(clippy::missing_errors_doc)].

Closes #4854.

changelog: adds lint for missing_errors_doc

The Rust Book recommends that functions that return a `Result` type have
a doc comment with an `# Errors` section describing the kind of errors
that can be returned
(https://doc.rust-lang.org/book/ch14-02-publishing-to-crates-io.html#commonly-used-sections).
This change adds a lint to enforce this. The lint is allow by default;
it can be enabled with `#![warn(clippy::missing_errors_doc)]`.

Closes rust-lang#4854.
@llogiq
Copy link
Contributor

llogiq commented Dec 6, 2019

Looks good to me. Thanks!

@bors r+

@bors
Copy link
Collaborator

bors commented Dec 6, 2019

📌 Commit f5d0a45 has been approved by llogiq

@bors
Copy link
Collaborator

bors commented Dec 6, 2019

⌛ Testing commit f5d0a45 with merge 61b19a1...

bors added a commit that referenced this pull request Dec 6, 2019
Add lint for pub fns returning a `Result` without documenting errors

The Rust Book recommends that functions that return a `Result` type have [a doc comment with an `# Errors` section](https://doc.rust-lang.org/book/ch14-02-publishing-to-crates-io.html#commonly-used-sections) describing the kind of errors that can be returned. This change adds a lint to enforce this. The lint is allow by default; it can be enabled with `#![warn(clippy::missing_errors_doc)]`.

Closes #4854.

changelog: adds lint for `missing_errors_doc`
@bors
Copy link
Collaborator

bors commented Dec 6, 2019

☀️ Test successful - checks-travis, status-appveyor
Approved by: llogiq
Pushing 61b19a1 to master...

@bors bors merged commit f5d0a45 into rust-lang:master Dec 6, 2019
@RobbieClarken RobbieClarken deleted the warn-missing-errors branch December 6, 2019 12:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Warn on missing "Errors" section in docs for Result/Option returning methods.
3 participants