Closed
Description
Trying to satisfy the borrow checker in some cases leads to a little bit clumsy HashMap code. For example, if you want to find_or_insert but need to modify the value.
Here's an example where I had to work around this by using contains_key
and then find_mut
and insert
directly:
https://gist.github.com/metajack/5555485#file-gistfile2-diff-L28-L45
I suggest adding find_or_insert_mut
and find_or_insert_with_mut
. It might be better to use find_mut_or_insert
and find_mut_or_insert_with
as names perhaps.