54: fix clippy pedantic lints
This commit is contained in:
@@ -81,10 +81,11 @@ impl Cards {
|
|||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
|
||||||
fn contains_value(&self, value: &Value) -> bool {
|
fn contains_value(&self, value: Value) -> bool {
|
||||||
self.value_hashmap.contains_key(value)
|
self.value_hashmap.contains_key(&value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait CardTrait {
|
pub trait CardTrait {
|
||||||
fn to_value_hashmap(&self) -> HashMap<Value, usize>;
|
fn to_value_hashmap(&self) -> HashMap<Value, usize>;
|
||||||
fn to_suit_hashset(&self) -> HashSet<Suit>;
|
fn to_suit_hashset(&self) -> HashSet<Suit>;
|
||||||
@@ -101,7 +102,7 @@ impl CardTrait for CardsArray {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn to_value_hashmap(&self) -> HashMap<Value, usize> {
|
fn to_value_hashmap(&self) -> HashMap<Value, usize> {
|
||||||
let mut hm = HashMap::from_iter(self.to_value_hashset().iter().map(|v| (*v, 0)));
|
let mut hm: HashMap<_, _> = self.to_value_hashset().iter().map(|v| (*v, 0)).collect();
|
||||||
for card in self {
|
for card in self {
|
||||||
*hm.get_mut(&card.value).unwrap() += 1;
|
*hm.get_mut(&card.value).unwrap() += 1;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
use std::slice::Iter;
|
const NUMBER_VALUES: usize = 13;
|
||||||
|
|
||||||
pub type Values = [Value; 5];
|
pub type Values = [Value; 5];
|
||||||
|
|
||||||
@@ -41,8 +41,8 @@ impl From<char> for Value {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl Value {
|
impl Value {
|
||||||
pub fn iterator() -> Iter<'static, Value> {
|
pub fn iterator() -> std::array::IntoIter<Value, NUMBER_VALUES> {
|
||||||
VALUES.iter()
|
VALUES.into_iter()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user