Suggested code does not compile with or_fun_call #2186
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
L-suggestion
Lint: Improving, adding or fixing lint suggestions
In some cases suggested change regarding
or_fun_call
lint does not compile. Here's an example:pair
is partially borrowed. Callingid(pair.b)
is valid, because compiler can see that only fielda
is borrowed, so fieldb
can be freely used. Clippy suggests to useunwrap_or_else
, and move function call into a closure. However, the closure will borrowpair
fully which is not possible, and the code will not compile.The text was updated successfully, but these errors were encountered: