From 1f8110127f4c9223337234e276d40d2e3a49fece Mon Sep 17 00:00:00 2001 From: Sebastiano Giordano <46520354+Krahos@users.noreply.github.com> Date: Sat, 22 Feb 2025 12:12:28 +0100 Subject: [PATCH] chore: updating to 2024 edition --- flake.lock | 24 ++++++++++++------------ src/common/cards.rs | 2 +- src/common/hands.rs | 6 ++++++ src/tressette.rs | 8 ++++++-- 4 files changed, 25 insertions(+), 15 deletions(-) diff --git a/flake.lock b/flake.lock index b64c2d4..5e7acbe 100644 --- a/flake.lock +++ b/flake.lock @@ -5,11 +5,11 @@ "systems": "systems" }, "locked": { - "lastModified": 1726560853, - "narHash": "sha256-X6rJYSESBVr3hBoH0WbKE5KvhPU5bloyZ2L4K60/fPQ=", + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", "owner": "numtide", "repo": "flake-utils", - "rev": "c1dfcf08411b08f6b8615f7d8971a2bfa81d5e8a", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", "type": "github" }, "original": { @@ -20,11 +20,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1727122398, - "narHash": "sha256-o8VBeCWHBxGd4kVMceIayf5GApqTavJbTa44Xcg5Rrk=", + "lastModified": 1739866667, + "narHash": "sha256-EO1ygNKZlsAC9avfcwHkKGMsmipUk1Uc0TbrEZpkn64=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "30439d93eb8b19861ccbe3e581abf97bdc91b093", + "rev": "73cf49b8ad837ade2de76f87eb53fc85ed5d4680", "type": "github" }, "original": { @@ -36,11 +36,11 @@ }, "nixpkgs_2": { "locked": { - "lastModified": 1718428119, - "narHash": "sha256-WdWDpNaq6u1IPtxtYHHWpl5BmabtpmLnMAx0RdJ/vo8=", + "lastModified": 1736320768, + "narHash": "sha256-nIYdTAiKIGnFNugbomgBJR+Xv5F1ZQU+HfaBqJKroC0=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "e6cea36f83499eb4e9cd184c8a8e823296b50ad5", + "rev": "4bc9c909d9ac828a039f288cf872d16d38185db8", "type": "github" }, "original": { @@ -62,11 +62,11 @@ "nixpkgs": "nixpkgs_2" }, "locked": { - "lastModified": 1727404165, - "narHash": "sha256-kZCiYpQJBZ3kL9QymS88mCxpQwqo8KqvZeHk6LATuY8=", + "lastModified": 1740191166, + "narHash": "sha256-WqRxO1Afx8jPYG4CKwkvDFWFvDLCwCd4mxb97hFGYPg=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "76f0a61e733259e1034dd6523e039d04932ffefc", + "rev": "74a3fb71b0cc67376ab9e7c31abcd68c813fc226", "type": "github" }, "original": { diff --git a/src/common/cards.rs b/src/common/cards.rs index 616d847..8c4bd44 100644 --- a/src/common/cards.rs +++ b/src/common/cards.rs @@ -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); } diff --git a/src/common/hands.rs b/src/common/hands.rs index 105fb4b..e34ffdb 100644 --- a/src/common/hands.rs +++ b/src/common/hands.rs @@ -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}; @@ -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}; @@ -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(); @@ -162,6 +165,7 @@ impl PlayerId { /// # Examples /// /// ``` + /// #![feature(generic_const_exprs)] /// use shuftlib::common::hands::PlayerId; /// /// let id = PlayerId::<4>::new(0); @@ -399,6 +403,7 @@ where /// # Examples. /// /// ``` + /// #![feature(generic_const_exprs)] /// use shuftlib::common::hands::{OngoingTrick, PlayerId, TrickTakingGame}; /// use shuftlib::tressette::TressetteRules; /// @@ -507,6 +512,7 @@ where /// # Examples /// /// ``` + /// #![feature(generic_const_exprs)] /// use shuftlib::{common::{hands::OngoingHand}, tressette::TressetteRules}; /// /// let ongoing_hand = OngoingHand::::new(); diff --git a/src/tressette.rs b/src/tressette.rs index ff832d7..065ed23 100644 --- a/src/tressette.rs +++ b/src/tressette.rs @@ -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}; /// @@ -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.") @@ -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}; @@ -215,6 +217,7 @@ impl TressetteCard { /// /// # Examples /// ``` + /// #![feature(generic_const_exprs)] /// use shuftlib::{tressette::TressetteCard, common::cards::{Suit, ItalianRank}}; /// use num_rational::Rational32; /// @@ -244,6 +247,7 @@ impl TressetteCard { /// /// # Examples. /// ``` + /// #![feature(generic_const_exprs)] /// use shuftlib::common::cards::{ItalianCard, ItalianRank, Suit}; /// use shuftlib::tressette::TressetteCard; ///