-
Notifications
You must be signed in to change notification settings - Fork 1.7k
let_unit_value
triggers on generic return value
#8998
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
Comments
Error: Label regression-from-stable-to-nightly can only be set by Rust team members Please let |
I assume the |
Yup, that's why I wrote the playground example as such |
@rustbot claim |
For what it's worth, I think that would be a false positive even if the suggestion didn't cause a compilation error. Writing |
I'm running into this with a channel. Approximate code looks like let (_tx, rx) = oneshot::channel();
let handle = spawn(async {
let () = rx.await.unwrap();
}); (the context here is a test case for abortion behavior on the |
I don't know why this was marked as closed - as far as I can tell, it was not fixed, at least not in this specific case (in an async context of course): let () = futures::future::pending().await; |
Summary
When using
objc
, a library commonly used when dealing with Objective-C, you often have to uselet _: () = ...
to tell the compiler what the return type, since the return type is generic.This triggers the lint. Trying to apply the lint's suggestion results in a compilation error. The lint doesn't trigger on Rust
1.61.0
.Lint Name
let_unit_value
Reproducer
I tried the following code (see this playground link for a simplified testcase):
I expected the lint to not trigger, instead it triggers on the last statement.
Version
Additional Labels
@rustbot label +regression-from-stable-to-nightly
@rustbot label +I-suggestion-causes-error
The text was updated successfully, but these errors were encountered: