logoalt Hacker News

the_mitsuhikoyesterday at 3:51 PM1 replyview on HN

But it's also not marked at the implementation for HashMap's Index impl for instance.


Replies

tialaramexyesterday at 6:04 PM

This didn't seem like a footgun to me, hats["Jim"]; will panic if, in fact "Jim" isn't one of the keys, but what did the hypothetical author expect to happen when they write this? HashMap doesn't implement IndexMut so hats["Jim"] = 26; won't even compile.

show 1 reply