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

Confusing message (empty attribute) in double_must_use #13003

Closed
ChrisJefferson opened this issue Jun 28, 2024 · 1 comment · Fixed by #13241
Closed

Confusing message (empty attribute) in double_must_use #13003

ChrisJefferson opened this issue Jun 28, 2024 · 1 comment · Fixed by #13241
Labels
C-bug Category: Clippy is not doing the correct thing

Comments

@ChrisJefferson
Copy link

Summary

The double_must_use message is:

warning: this function has an empty `#[must_use]` attribute, but returns a type already marked as `#[must_use]`

However, I don't know what an 'empty attribute' is. I tried googling for the term, and nothing came up.

Reproducer

No response

Version

rustc 1.79.0 (129f3b996 2024-06-10)
binary: rustc
commit-hash: 129f3b9964af4d4a709d1383930ade12dfe7c081
commit-date: 2024-06-10
host: x86_64-unknown-linux-gnu
release: 1.79.0
LLVM version: 18.1.7

Additional Labels

No response

@ChrisJefferson ChrisJefferson added the C-bug Category: Clippy is not doing the correct thing label Jun 28, 2024
@y21
Copy link
Member

y21 commented Jun 28, 2024

In the context of this lint, #[must_use] is empty, #[must_use = "message"] is not.
The lint only warns on the former since must_use with a message can add additional context for that specific function that the type's #[must_use] message does not have, in which case it would not be redundant.

Maybe it could say "this function has a #[must_use] attribute with no message, but returns a type already marked as #[must_use]"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: Clippy is not doing the correct thing
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants