Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/common/cards.rs
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ mod tests {

let decks = sorted_deck.cards.iter().zip(shuffled_deck.cards.iter());

let count_of_different_cards = decks.filter(|(&card1, &card2)| card1 != card2).count();
let count_of_different_cards = decks.filter(|&(&card1, &card2)| card1 != card2).count();

assert_ne!(count_of_different_cards, 0);
}
Expand Down
6 changes: 6 additions & 0 deletions src/common/hands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ where
///
/// # Examples
/// ```
/// #![feature(generic_const_exprs)]
/// use shuftlib::common::hands::{Player, TrickTakingGame, PlayerId};
/// use shuftlib::common::cards::{ItalianRank, Suit};
/// use shuftlib::tressette::{TressetteRules, TressetteCard};
Expand All @@ -71,6 +72,7 @@ where
///
/// # Examples
/// ```
/// #![feature(generic_const_exprs)]
/// use shuftlib::common::hands::{Player, TrickTakingGame, PlayerId};
/// use shuftlib::common::cards::{ItalianRank, Suit};
/// use shuftlib::tressette::{TressetteRules, TressetteCard};
Expand Down Expand Up @@ -107,6 +109,7 @@ where
/// # Examples.
///
/// ```
/// #![feature(generic_const_exprs)]
/// use shuftlib::{common::hands::{Player, PlayerId, TrickTakingGame}, tressette::TressetteRules};
///
/// let id = PlayerId::<{TressetteRules::PLAYERS}>::new(0).unwrap();
Expand Down Expand Up @@ -162,6 +165,7 @@ impl<const PLAYERS: usize> PlayerId<PLAYERS> {
/// # Examples
///
/// ```
/// #![feature(generic_const_exprs)]
/// use shuftlib::common::hands::PlayerId;
///
/// let id = PlayerId::<4>::new(0);
Expand Down Expand Up @@ -399,6 +403,7 @@ where
/// # Examples.
///
/// ```
/// #![feature(generic_const_exprs)]
/// use shuftlib::common::hands::{OngoingTrick, PlayerId, TrickTakingGame};
/// use shuftlib::tressette::TressetteRules;
///
Expand Down Expand Up @@ -507,6 +512,7 @@ where
/// # Examples
///
/// ```
/// #![feature(generic_const_exprs)]
/// use shuftlib::{common::{hands::OngoingHand}, tressette::TressetteRules};
///
/// let ongoing_hand = OngoingHand::<TressetteRules>::new();
Expand Down
8 changes: 6 additions & 2 deletions src/tressette.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ impl TrickTakingGame for TressetteRules {
/// # Examples
///
/// ```
/// #![feature(generic_const_exprs)]
/// use shuftlib::common::{hands::{TrickTakingGame, PlayerId}, cards::{ItalianRank, Suit}};
/// use shuftlib::tressette::{TressetteRules, TressetteCard};
///
Expand All @@ -56,8 +57,8 @@ impl TrickTakingGame for TressetteRules {
let (taker, _) = cards
.iter()
.enumerate()
.filter(|(_, &c)| c.suit() == leading_suit)
.max_by_key(|(_, &c)| c)
.filter(|&(_, &c)| c.suit() == leading_suit)
.max_by_key(|&(_, &c)| c)
.expect("Max by key returned None. This shouldn't have happened, since it's being called on a non empty slice.");

PlayerId::new(taker).expect("Initialization of a new PlayerId failed. This shouldn't have happened, since the input usize was computed starting from a fixed length slice.")
Expand All @@ -82,6 +83,7 @@ impl TressetteRules {
/// # Examples
///
/// ```
/// #![feature(generic_const_exprs)]
/// use shuftlib::tressette::{TressetteRules, TressetteCard};
/// use shuftlib::common::hands::Player;
/// use shuftlib::common::cards::{Suit, ItalianRank};
Expand Down Expand Up @@ -215,6 +217,7 @@ impl TressetteCard {
///
/// # Examples
/// ```
/// #![feature(generic_const_exprs)]
/// use shuftlib::{tressette::TressetteCard, common::cards::{Suit, ItalianRank}};
/// use num_rational::Rational32;
///
Expand Down Expand Up @@ -244,6 +247,7 @@ impl TressetteCard {
///
/// # Examples.
/// ```
/// #![feature(generic_const_exprs)]
/// use shuftlib::common::cards::{ItalianCard, ItalianRank, Suit};
/// use shuftlib::tressette::TressetteCard;
///
Expand Down