-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
expect
attribute supressing lint, but then saying it's not fulfilled
#12998
Comments
This may be a bug in clippy's implementation of the lint: https://rust-lang.zulipchat.com/#narrow/stream/257328-clippy/topic/Possible.20bug.3F/near/410324973 |
This is a most likely a bug in Clippy. The old playground link from the issue doesn't work anymore, but here is a new working one: https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=c87895279ad49e3067a5ec9c812bf6a9 The problem is likely that the lint is not emitted at the right place. I'll transfer it to the Clippy repo. |
This comment was marked as off-topic.
This comment was marked as off-topic.
Lol, yep found the corporate: if !cx.tcx.hir().attrs(expr.hir_id).is_empty() {
return;
} The lint is apparently suppressed if there is any attribute on the return. Now comes the fun part of figuring out why xD |
Ignoring attributes seem to be intentional: #9361 I can still make it work for |
NOTE: This is using
cargo clippy
, but the actual issue may be in thelint_reasons
feature. If this is not appropriate for the rustc repo, let me know and I can copy it over to clippy's.I tried this code:
playground (Use Clippy)
I expected to see this happen: No output because clippy emits the
clippy::needless_return
lint, which should satisfy theexpect
.Instead, this happened:
Meta
rustc --version --verbose
:@rustbot label +T-compiler +A-clippy +A-lint +F-lint_reasons
The text was updated successfully, but these errors were encountered: