@@ -128,7 +128,7 @@ impl ConwayVoting {
128128 ) -> Result < ( ) > {
129129 self . votes_count += voter_votes. voting_procedures . len ( ) ;
130130 for ( action_id, procedure) in voter_votes. voting_procedures . iter ( ) {
131- let votes = self . votes . entry ( action_id. clone ( ) ) . or_insert_with ( || HashMap :: new ( ) ) ;
131+ let votes = self . votes . entry ( action_id. clone ( ) ) . or_default ( ) ;
132132
133133 match self . action_status . get ( action_id) {
134134 None => {
@@ -149,7 +149,7 @@ impl ConwayVoting {
149149 }
150150
151151 if let Some ( ( prev_trans, prev_vote) ) =
152- votes. insert ( voter. clone ( ) , ( transaction. clone ( ) , procedure. clone ( ) ) )
152+ votes. insert ( voter. clone ( ) , ( * transaction, procedure. clone ( ) ) )
153153 {
154154 // Re-voting is allowed; new vote must be treated as the proper one,
155155 // older is to be discarded.
@@ -202,8 +202,8 @@ impl ConwayVoting {
202202
203203 /// Should be called when voting is over
204204 fn end_voting ( & mut self , action_id : & GovActionId ) -> Result < ( ) > {
205- self . votes . remove ( & action_id) ;
206- self . proposals . remove ( & action_id) ;
205+ self . votes . remove ( action_id) ;
206+ self . proposals . remove ( action_id) ;
207207
208208 Ok ( ( ) )
209209 }
@@ -223,7 +223,7 @@ impl ConwayVoting {
223223 pool : VoteCount :: zero ( ) ,
224224 } ;
225225
226- let Some ( all_votes) = self . votes . get ( & action_id) else {
226+ let Some ( all_votes) = self . votes . get ( action_id) else {
227227 return Ok ( votes) ;
228228 } ;
229229
@@ -334,10 +334,10 @@ impl ConwayVoting {
334334 spo_stake : & HashMap < PoolId , DelegatedStake > ,
335335 ) -> Result < Option < VotingOutcome > > {
336336 let outcome =
337- self . is_finally_accepted ( new_epoch, voting_state, & action_id, drep_stake, spo_stake) ?;
338- let expired = self . is_expired ( new_epoch, & action_id) ?;
337+ self . is_finally_accepted ( new_epoch, voting_state, action_id, drep_stake, spo_stake) ?;
338+ let expired = self . is_expired ( new_epoch, action_id) ?;
339339 if outcome. accepted || expired {
340- self . end_voting ( & action_id) ?;
340+ self . end_voting ( action_id) ?;
341341 info ! (
342342 "New epoch {new_epoch}: voting for {action_id} outcome: {}, expired: {expired}" ,
343343 outcome. accepted
@@ -362,7 +362,7 @@ impl ConwayVoting {
362362
363363 /// Function dumps information about completed (expired, ratified, enacted) governance
364364 /// actions in format, close to that of `gov_action_proposal` from `sqldb`.
365- pub fn print_outcome_to_verify ( & self , outcome : & Vec < GovernanceOutcome > ) -> Result < ( ) > {
365+ pub fn print_outcome_to_verify ( & self , outcome : & [ GovernanceOutcome ] ) -> Result < ( ) > {
366366 let out_file_name = match & self . verification_output_file {
367367 Some ( o) => o,
368368 None => return Ok ( ( ) ) ,
@@ -416,7 +416,7 @@ impl ConwayVoting {
416416 {ratification_info},{cast},{threshold}\n ",
417417 elem. voting. procedure. gov_action_id
418418 ) ;
419- if let Err ( e) = out_file. write ( & res. as_bytes ( ) ) {
419+ if let Err ( e) = out_file. write ( res. as_bytes ( ) ) {
420420 error ! (
421421 "Cannot write 'res' to verification output {out_file_name} for writing: {e}"
422422 ) ;
@@ -434,7 +434,7 @@ impl ConwayVoting {
434434 spo_stake : & HashMap < PoolId , DelegatedStake > ,
435435 ) -> Result < Vec < GovernanceOutcome > > {
436436 let mut outcome = Vec :: < GovernanceOutcome > :: new ( ) ;
437- let actions = self . proposals . keys ( ) . map ( |a| a . clone ( ) ) . collect :: < Vec < _ > > ( ) ;
437+ let actions = self . proposals . keys ( ) . cloned ( ) . collect :: < Vec < _ > > ( ) ;
438438
439439 for action_id in actions. iter ( ) {
440440 info ! (
@@ -443,8 +443,8 @@ impl ConwayVoting {
443443 ) ;
444444 let one_outcome = match self . process_one_proposal (
445445 new_block. epoch ,
446- & voting_state,
447- & action_id,
446+ voting_state,
447+ action_id,
448448 drep_stake,
449449 spo_stake,
450450 ) {
@@ -508,7 +508,7 @@ impl ConwayVoting {
508508 pub fn update_action_status_with_outcomes (
509509 & mut self ,
510510 epoch : u64 ,
511- outcomes : & Vec < GovernanceOutcome > ,
511+ outcomes : & [ GovernanceOutcome ] ,
512512 ) -> Result < ( ) > {
513513 for one_outcome in outcomes. iter ( ) {
514514 let action_id = & one_outcome. voting . procedure . gov_action_id ;
@@ -601,8 +601,8 @@ mod tests {
601601 } ,
602602 ) ;
603603
604- voting. update_action_status_with_outcomes ( 0 , & vec ! [ ] ) ?;
605- voting. update_action_status_with_outcomes ( 1 , & vec ! [ oc1. clone ( ) ] ) ?;
604+ voting. update_action_status_with_outcomes ( 0 , & [ ] ) ?;
605+ voting. update_action_status_with_outcomes ( 1 , std :: slice :: from_ref ( & oc1) ) ?;
606606 assert_eq ! (
607607 voting
608608 . action_status
0 commit comments