rust-lang / rust-lang/rust-clippy
`missing_errors_doc` dont work when attribute `#[profiling::function]` is set
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 13.5k
- Forks
- 2.2k
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 32
Description
Summary
When attribute #[profiling::function] is set on a function, the lint missing_errors_doc trigger any warning even if the function can return an error and possible returned Errors is not documented.
While just remove the attribute allow to have report of the missing Error doc again.
Lint Name
missing_errors_doc
Reproduce
trigger the lint as expected
/// Divide 100 by the value indicated
/// => Reference which trigger the lint.
pub fn div_hundred_by(value: u32) -> Result<u32, Error> {
if value == 0 {
return Err(Error::DivByZero);
}
Ok(100 / value)
}
don't trigger the lint
/// Divide 1000 by the value indicated
/// => variation with marker `#[profiling::function]` added.
#[profiling::function]
pub fn div_thousand_by(value: u32) -> Result<u32, Error> {
if value == 0 {
return Err(Error::DivByZero);
}
Ok(1000 / value)
}
A demo project is available here : https://github.com/gwen-lg/clippy-lints-doc-tests
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the missing_errors_doc lint and the provided reproduction, then compare behavior for the function with and without #[profiling::function]. Use the linked demo project to confirm the expected result: the lint should warn when an error-returning function's possible errors are undocumented, including when the profiling attribute is present.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100