rustlings
rustlings copied to clipboard
hashmaps3.rs name in the Team struct
Is having name
in the team struct actually necessary? The team name is already used as the key, so I realistically don't see a reason to also have it in the value. The name
in the team struct can also be completely bypassed, as it is not being tested for, so you can put anything you'd like in there and still complete the exercise.
Yea, It is an unused double entry in the same data structure. I wondered about that too.
I too was concerned about the compiler pointing out "warning: field `name` is never read".
I don't know of a model answer to this question, but it seems to me that the duplication of names forces a clone()
that is not really needed.
I believe this merged PR closes this issue https://github.com/rust-lang/rustlings/pull/1547