From: Geoffrey Allott Date: Thu, 25 Mar 2021 18:19:08 +0000 (+0000) Subject: Revert "fix for older rustc" X-Git-Url: https://git.pointlesshacks.com/?a=commitdiff_plain;h=fb2b22e2037f643400325575ead152e2751cf82c;p=pokerwave.git Revert "fix for older rustc" This reverts commit efa281e75c0ba7218ada583a671eee65f8720cda. --- diff --git a/src/game/poker/holdem.rs b/src/game/poker/holdem.rs index 5361ac9..ed64bff 100644 --- a/src/game/poker/holdem.rs +++ b/src/game/poker/holdem.rs @@ -1,5 +1,6 @@ use std::cmp::Ordering; use std::collections::{HashMap, HashSet}; +use std::convert::TryInto; use itertools::Itertools; @@ -7,7 +8,7 @@ use crate::card::{Card, FIFTY_TWO_CARD_DECK}; use crate::rng::{Seed, WaveRng}; use crate::seats::Seats; use crate::username::Username; -use crate::util::{array::TryIntoArray, max::IteratorMaxItems, timestamp::Timestamp}; +use crate::util::{max::IteratorMaxItems, timestamp::Timestamp}; use super::super::{Action, ActionError, DealerAction, Game, StartCondition, UserAction, ValidatedUserAction}; @@ -639,7 +640,7 @@ impl Game for TexasHoldEm { .iter() .sorted_by_key(|&(username, _)| username) .map(|(&username, hand)| (username, hand.iter().chain(self.community.iter()).cloned().collect::>())) - .filter_map(|(username, cards)| cards.try_into_array().ok().map(rank_7_card_hand).map(|hand| (username, hand))) + .filter_map(|(username, cards)| cards.try_into().ok().map(rank_7_card_hand).map(|hand| (username, hand))) .max_items_by_key(|(_, hand)| *hand); info!("Showdown: community: {:?}", self.community); info!("Showdown: all hands: {:?}", self.hands); diff --git a/src/util/array.rs b/src/util/array.rs deleted file mode 100644 index 882dd21..0000000 --- a/src/util/array.rs +++ /dev/null @@ -1,12 +0,0 @@ -pub trait TryIntoArray { - fn try_into_array(self) -> Result; -} - -impl TryIntoArray<[T; 7]> for Vec { - fn try_into_array(self) -> Result<[T; 7], usize> { - match *self { - [a, b, c, d, e, f, g] => Ok([a, b, c, d, e, f, g]), - _ => Err(self.len()), - } - } -} diff --git a/src/util/mod.rs b/src/util/mod.rs index 6eddd82..1a4b272 100644 --- a/src/util/mod.rs +++ b/src/util/mod.rs @@ -1,4 +1,3 @@ -pub mod array; pub mod dedup; pub mod max; pub mod timestamp;