rustlings icon indicating copy to clipboard operation
rustlings copied to clipboard

hashmaps3.rs name in the Team struct

Open radiden opened this issue 2 years ago • 3 comments

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.

radiden avatar Aug 21 '22 18:08 radiden

Yea, It is an unused double entry in the same data structure. I wondered about that too.

PerryCameron avatar Aug 21 '22 20:08 PerryCameron

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.

NaokiM03 avatar Aug 22 '22 16:08 NaokiM03

I believe this merged PR closes this issue https://github.com/rust-lang/rustlings/pull/1547

Ben2917 avatar Jul 30 '23 14:07 Ben2917