-
Notifications
You must be signed in to change notification settings - Fork 66
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
Unit type fallback lint in nightly #270
Comments
With the release of Rust 1.81.0, this lint is now on by default. I am not entirely sure the solution would be - else I'd submit a PR, but I'll have a play around and see if I can formulate anything, in the mean time the solutions listed above work. |
There's a long thread about this in this redis-rs repo, and a link to a discord discussion with more info: redis-rs/redis-rs#1228 Unfortunately I don't think there really is a solution to this. It sounds like the use case of functions that have side effects with generic return values that can be conditionally ignored is just not well supported by the current type system. The partial workaround that redis-rs used was to expose a new function without any generics that can be used when callers don't care about the result. |
Thanks, I probably agree with this comment, the |
Sorry I'm not able to see the link behind that comment you've linked to, but are you saying that in application code we should annotate thusly to avoid this? (This is currently breaking some of my crates that depend on |
Yeah, you'll want to use the |
This isn't a bug report. There's a new lint that was recently added:
dependency_on_unit_never_type_fallback
(see rust-lang/rust#123748)and it triggers for
fred
calls that do not explicitly specify return type.For example:
will trigger it because return value is implicitly
()
.It can be avoided by changing code to:
I wonder if there's a way to address it in
fred
without changing all the call sites to explicitly specify unit return type?The text was updated successfully, but these errors were encountered: