-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Lint using |_| () instead of drop #2523
Comments
I don't agree. To me, |
@birkenfeld Do you have a good example of a case like that? Something like |
drop is definitely much more readable imo and other people seem to be confused by "the toilet closure" too: https://www.reddit.com/r/rust/comments/bdqxch/actixweb_what_map_err_is_really_doing/ |
I don't find drop to be readable in an error context. The toilet closure is confusing too, but at least it's become a norm. |
People in rust-lang/rust#67672 prefer |
The same for me. How about alias for drop:
|
I may be weird, but I think dropping is empathically not the same as ignoring it. And in Rust, we don't tend to ignore things anyway. |
I'm very much not in favour of things doing exactly the same thing but having different names. Toilet closures are unnamed, although I still find drop easier to read. If we were to make an actual exported alias for drop I'd be against that. |
Basically, any occurrence of
|_| ()
as a closure could be more clearly worded asdrop
.The text was updated successfully, but these errors were encountered: