Conversation
|
Lintcheck changes for de1028a
This comment will be updated if you push new changes |
|
☔ The latest upstream changes (possibly e1130b6) made this pull request unmergeable. Please resolve the merge conflicts. |
|
This is not a good way to fix This is not saying there's nothing to fix here. |
|
@Jarcho Could you provide an example for me to consider? At least as far as I see this change, it only updates an The only change that I would expect to arguably be breaking would be recommendations, which as shown in the tests, now may suggest to use a closure for a simple function call. This would actually be more conservative as I see it |
|
Something like: if foo { Some(x.len()) }
else { None }This should be suggesting In such a case
|
Update
unnecessary_lazy_evaluationsto allow closures for trivial functions according to the developer's preference.The current list of trivial functions is
is_empty,len, andas_*. This list cannot be updated without causing churn, because e.g., calls tounwrap_or_elseandunwrap_orwould need to be swapped for each addition and removal. This list is also undocumented and not based on actual method complexity, but repositories need to follow it to be compliant with this default lint. Leaving these trivial functions up to developer preference allows developers to not need to think about which functions Clippy considers lazy.A configuration could be added later to re-enable this without any backward-compatibility concern, but it should not be enforced by default.
changelog: [
unnecessary_lazy_evaluations]: allow optional closure for trivial functionsFixes: #8109