Help me Fediverse #rust Wan Kinobe, you're my only hope! :)
I'm working on a #rustlings exercise:
https://github.com/rust-lang/rustlings/blob/main/exercises/11_hashmaps/hashmaps3.rs
This is the first time I'm irretrievably stuck.
My code:
https://gist.github.com/feoh/5247717974a727a18d3c5adc2d292aed
This is the error I get:
error[E0308]: mismatched types
--> exercises/hashmaps/hashmaps3.rs:42:27
|
42 | let team1: Team = scores.entry(team_1_name).or_insert(Team {
| _________________----^
| | |
| | expected due to this
43 | | goals_scored: team_1_score,
44 | | goals_conceded: team_2_score,
45 | | });
| |__________^ expected Team
, found &mut Team
error[E0308]: mismatched types
--> exercises/hashmaps/hashmaps3.rs:46:27
|
46 | let team2: Team = scores.entry(team_2_name).or_insert(Team {
| _________________----^
| | |
| | expected due to this
47 | | goals_scored: team_2_score,
48 | | goals_conceded: team_1_score,
49 | | });
| |__________^ expected Team
, found &mut Team
error: aborting due to 2 previous errors
Do I somehow want to copy my modified team1 / team2 Team structs into immutable versions so the insert will work?
This is for an exercise, so "Do your damn homework and figure it out bright boy" is entirely acceptable as well, but I've not been this stuck in the hundreds of exercises I've done thus far :)
Thanks!