This took me too long to figure out (I'm still a Rust noob). I was cloning a
&HashMap<> so it can become owned, but kept giving me another
&HashMap. The error I was getting was similar to this SO question (ignoring that the answer's
HashMap contains generics--my case was using concrete types), and here is where I found the answer that I had to make sure
V are Clone too.
= note: expected type `std::collections::HashMap<K, std::collections::HashSet<V>>` found type `&std::collections::HashMap<K, std::collections::HashSet<V>>`
This error isn't directly because of that, but it makes me suggest that the compiler can detect that and suggest something along the lines of:
Looks like you tried to clone() your HashMap earlier and it's a still borrow. You will need to make sure your key and value types impl the Clone trait too.