filter_map_bool_then
generates incorrect autofix when the bool
in question is a reference
#11503
Labels
C-bug
Category: Clippy is not doing the correct thing
I-suggestion-causes-error
Issue: The suggestions provided by this Lint cause an ICE/error when applied
Summary
Method calls implicitly dereference
self
, sothen
can be called on (possibly nested) references tobool
. The autofix forfilter_map_bool_then
doesn’t take this into account and tries to return references tobool
fromfilter
.Reproducer
I tried this code:
I expected to see this happen:
cargo clippy --fix
should generate code like this:Instead, this happened:
Version
Additional Labels
@rustbot label +I-suggestion-causes-error
The text was updated successfully, but these errors were encountered: