Revert "fix for older rustc"
authorGeoffrey Allott <geoffrey@allott.email>
Thu, 25 Mar 2021 18:19:08 +0000 (18:19 +0000)
committerGeoffrey Allott <geoffrey@allott.email>
Thu, 25 Mar 2021 18:19:08 +0000 (18:19 +0000)
This reverts commit efa281e75c0ba7218ada583a671eee65f8720cda.

src/game/poker/holdem.rs
src/util/array.rs [deleted file]
src/util/mod.rs

index 5361ac9aae47552e82d5a56421c6096843c3c00a..ed64bff622986805bdddcde3d475da07bdb93e87 100644 (file)
@@ -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::<Vec<_>>()))
-                    .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 (file)
index 882dd21..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-pub trait TryIntoArray<A> {
-    fn try_into_array(self) -> Result<A, usize>;
-}
-
-impl <T: Copy> TryIntoArray<[T; 7]> for Vec<T> {
-    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()),
-        }
-    }
-}
index 6eddd824a97085b021cccf1917b219e0cd7cda59..1a4b2720dfd954fc9a5fc8183b9d840c41953a07 100644 (file)
@@ -1,4 +1,3 @@
-pub mod array;
 pub mod dedup;
 pub mod max;
 pub mod timestamp;