Closed
Description
Description
I propose the following changes to or_fun_call
and unwrap_or_else_default
(which I would implement):
- Implement the missing functionality from Suggest
Entry::or_default
forEntry::or_insert(Default::default())
#9342, e.g., handleor_insert_with(Default::default)
. - Merge
unwrap_or_else_default
intoor_fun_call
. At present, there is an ambiguity as to where the just mentioned new functionality should go. However, I agree with @giraffate when he wrote here that things likeunwrap_or_else(Vec::new)
should be handled byor_fun_call
. Mergingunwrap_or_else_default
intoor_fun_call
would resolve the ambiguity. - Move
or_fun_call
to complexity. If I understand correctly, the "false positives" described in Make it clear thator_fun_call
can be a false-positive #9829 are because the suggestions don't improve performance, not that the suggestions don't apply. However, even when the suggestions don't improve performance, they still improve "code that does something simple but in a complex way."
Note that 2 and 3 are intertwined. If I have misunderstood the reasoning in #9829, it might make sense to keep unwrap_or_else_default
as a separate style lint. (cc: @hrxi @llogiq)
Thoughts?
Version
No response
Additional Labels
No response
Metadata
Metadata
Assignees
Labels
No labels