Skip to content

Commit d00302c

Browse files
committed
Prevent dereferencing
1 parent ede406c commit d00302c

File tree

1 file changed

+7
-6
lines changed
  • backend/apportionment/src/candidate_nomination

1 file changed

+7
-6
lines changed

backend/apportionment/src/candidate_nomination/mod.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -106,26 +106,27 @@ fn candidate_nomination_per_list(
106106
let (list_number, list_seats) = total_seats
107107
.iter()
108108
.find(|(number, _)| *number == list.number)
109-
.expect("Total seats exists");
109+
.expect("Total seats exists")
110+
.to_owned();
110111
let candidate_votes = &list.candidate_votes;
111112
let candidate_votes_meeting_preference_threshold =
112113
candidate_votes_meeting_preference_threshold(preference_threshold, candidate_votes);
113114
let preferential_candidate_nomination = preferential_candidate_nomination(
114115
&candidate_votes_meeting_preference_threshold,
115-
*list_seats,
116+
list_seats,
116117
)?;
117118

118119
// [Artikel P 17 Kieswet](https://wetten.overheid.nl/BWBR0004627/2026-01-01/#AfdelingII_HoofdstukP_Paragraaf3_ArtikelP17)
119120
let other_candidate_nomination = other_candidate_nomination(
120121
&preferential_candidate_nomination,
121122
candidate_votes,
122-
*list_seats as usize - preferential_candidate_nomination.len(),
123+
list_seats as usize - preferential_candidate_nomination.len(),
123124
);
124125

125126
// [Artikel P 19 Kieswet](https://wetten.overheid.nl/BWBR0004627/2026-01-01/#AfdelingII_HoofdstukP_Paragraaf3_ArtikelP19)
126127
let updated_candidate_ranking: Vec<CandidateNumber> =
127128
if candidate_votes_meeting_preference_threshold.is_empty()
128-
|| (seats >= LARGE_COUNCIL_THRESHOLD && *list_seats == 0)
129+
|| (seats >= LARGE_COUNCIL_THRESHOLD && list_seats == 0)
129130
{
130131
vec![]
131132
} else {
@@ -147,8 +148,8 @@ fn candidate_nomination_per_list(
147148
};
148149

149150
list_candidate_nomination.push(ListCandidateNomination {
150-
list_number: *list_number,
151-
list_seats: *list_seats,
151+
list_number,
152+
list_seats,
152153
preferential_candidate_nomination,
153154
other_candidate_nomination,
154155
updated_candidate_ranking,

0 commit comments

Comments
 (0)