remove dead code in 51
This commit is contained in:
+1
-20
@@ -85,22 +85,6 @@ impl Cards {
|
||||
self.value_hashmap.contains_key(value)
|
||||
}
|
||||
}
|
||||
|
||||
trait Contains<T> {
|
||||
fn contains_value(&self, x: &T) -> bool;
|
||||
}
|
||||
|
||||
impl Contains<Value> for &CardsArray {
|
||||
fn contains_value(&self, x: &Value) -> bool {
|
||||
for card in self.iter() {
|
||||
if card.value == *x {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
pub trait CardTrait {
|
||||
fn to_value_hashmap(&self) -> HashMap<Value, usize>;
|
||||
fn to_suit_hashset(&self) -> HashSet<Suit>;
|
||||
@@ -117,10 +101,7 @@ impl CardTrait for CardsArray {
|
||||
}
|
||||
|
||||
fn to_value_hashmap(&self) -> HashMap<Value, usize> {
|
||||
let mut hm = HashMap::new();
|
||||
for value in self.to_value_hashset() {
|
||||
hm.insert(value, 0);
|
||||
}
|
||||
let mut hm = HashMap::from_iter(self.to_value_hashset().iter().map(|v| (*v, 0)));
|
||||
for card in self {
|
||||
*hm.get_mut(&card.value).unwrap() += 1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user