From 21b7b57336cd3bf7bd328ada38c6069a48504f85 Mon Sep 17 00:00:00 2001 From: Kjetil Orbekk Date: Tue, 27 Dec 2022 19:55:10 -0500 Subject: `cargo fmt` --- protocol/src/bridge_engine.rs | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) (limited to 'protocol/src/bridge_engine.rs') diff --git a/protocol/src/bridge_engine.rs b/protocol/src/bridge_engine.rs index 37687b8..0bc3434 100644 --- a/protocol/src/bridge_engine.rs +++ b/protocol/src/bridge_engine.rs @@ -109,10 +109,12 @@ impl Trick { } }; - let (i, _) = self.cards_played + let (i, _) = self + .cards_played .iter() .enumerate() - .max_by(|&(_, c1), &(_, c2)| value(c1).cmp(&value(c2))).unwrap(); + .max_by(|&(_, c1), &(_, c2)| value(c1).cmp(&value(c2))) + .unwrap(); self.leader.many_next(i) } } @@ -148,7 +150,10 @@ impl TurnInPlay { &self.trick.cards_played[..] } - pub fn play(mut self: TurnInPlay, card: Card) -> MoveResult { + pub fn play( + mut self: TurnInPlay, + card: Card, + ) -> MoveResult { self.trick.cards_played.push(card); if self.trick.cards_played.len() >= 4 { return MoveResult::Next(self.trick); @@ -231,12 +236,10 @@ impl DealInPlay { player_cards.remove(i); Ok(match self.in_progress.play(card) { - MoveResult::Current(turn) => { - MoveResult::Current(Self { - in_progress: turn, - ..self - }) - } + MoveResult::Current(turn) => MoveResult::Current(Self { + in_progress: turn, + ..self + }), MoveResult::Next(trick) => { let trick_winner = trick.winner(self.trump_suit); let mut tricks = self.tricks_played; @@ -681,9 +684,7 @@ impl PlayState { ..self }) } - MoveResult::Next(_) => { - PlayStateResult::PlayFinished(PlayResult) - } + MoveResult::Next(_) => PlayStateResult::PlayFinished(PlayResult), }) } } @@ -1307,7 +1308,9 @@ mod tests { assert_eq!(player_state.current_player(), play_state.current_player()); } - fn as_playing_hand(result: MoveResult>) -> DealInPlay { + fn as_playing_hand( + result: MoveResult>, + ) -> DealInPlay { match result { MoveResult::Current(r) => r, MoveResult::Next(_) => { -- cgit v1.2.3