Skip to content

Commit

Permalink
Appease clippy by replacing fold with max
Browse files Browse the repository at this point in the history
  • Loading branch information
pashadia committed Dec 19, 2023
1 parent 6f66114 commit bb889b5
Showing 1 changed file with 4 additions and 16 deletions.
20 changes: 4 additions & 16 deletions src/poker/evaluators/badugi_evaluator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,22 +125,10 @@ pub fn evaluate_hand(player_hand: &Vec<Card>) -> Result<BadugiRank, EvaluatorErr

BadugiRank(rank)
})
.fold(
Err(EvaluatorError::FailedToCalculateRank(
"Badugi rank failed to generate".to_string(),
)),
|acc, rank| {
if let Ok(acc) = acc {
if rank > acc {
Ok(rank)
} else {
Ok(acc)
}
} else {
Ok(rank)
}
},
)
.max()
.ok_or(EvaluatorError::FailedToCalculateRank(
"Badugi rank failed to generate".to_string(),
))
}

#[cfg(test)]
Expand Down

0 comments on commit bb889b5

Please sign in to comment.