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

missing_errors_doc dont work when attribute #[profiling::function] is set #13484

Open
gwen-lg opened this issue Oct 1, 2024 · 0 comments
Open

Comments

@gwen-lg
Copy link

gwen-lg commented Oct 1, 2024

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

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

No branches or pull requests

1 participant