We can use HashMap::or_insert_with_key so that we don't need to clone the key.
HashMap::or_insert_with_key