You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Merge unwrap_or_else_default into or_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 like unwrap_or_else(Vec::new) should be handled by or_fun_call. Merging unwrap_or_else_default into or_fun_call would resolve the ambiguity.
Move or_fun_call to complexity. If I understand correctly, the "false positives" described in Make it clear that or_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)
Description
I propose the following changes to
or_fun_callandunwrap_or_else_default(which I would implement):Entry::or_defaultforEntry::or_insert(Default::default())#9342, e.g., handleor_insert_with(Default::default).unwrap_or_else_defaultintoor_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_defaultintoor_fun_callwould resolve the ambiguity.or_fun_callto complexity. If I understand correctly, the "false positives" described in Make it clear thator_fun_callcan 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_defaultas a separate style lint. (cc: @hrxi @llogiq)Thoughts?
Version
No response
Additional Labels
No response