impl AsyncFn
used as argument for function that takes impl Fn
passed as closure triggers clippy::redundant_closure
#13892
Labels
C-bug
Category: Clippy is not doing the correct thing
I-false-positive
Issue: The lint was triggered on code it shouldn't have
I-suggestion-causes-error
Issue: The suggestions provided by this Lint cause an ICE/error when applied
Summary
Currently, in the latest rust nightly, it's not possible to pass an
impl AsyncFn
into a function that takes animpl Fn
to call it without awaiting, without using a closure as a workaround.Still, clippy warns about using a closure to do this, and assumes you can just pass the asynchronous function directly, which would give a compile error.
Lint Name
clippy::redundant_closure
Reproducer
I tried this code (within an async context):
I saw this happen:
I expected to see this happen:
No warning, because what clippy suggests to do instead is not possible at the moment.
Version
Additional Labels
@rustbot -I-suggestion-causes-error
The text was updated successfully, but these errors were encountered: