filter_map_bool_then
triggers in some cases when variable is borrowed in predicate and transformation.
#11617
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
In cases where a variable needs to be borrowed by both the predicate function in
filter
and the transformation function inmap
, and one of those borrows is mutable, thefilter_map
->filter
+map
transformation is invalid.Lint Name
filter_map_bool_then
Reproducer
I tried this code:
I expect this to not trigger a lint warning because the transformation is invalid. The transformed code looks like:
This fails to compile because
x
is borrowed infilter
and mutably borrowed inmap
:Version
Additional Labels
@rustbot label +I-suggestion-causes-error
The text was updated successfully, but these errors were encountered: