From 67c29330a6874b198868efc9bd815ce6cd4a400e Mon Sep 17 00:00:00 2001 From: MarRue <20143778+gpluscb@users.noreply.github.com> Date: Thu, 31 Mar 2022 13:42:35 +0200 Subject: [PATCH] Remove outdated `as_ref`s --- README.md | 2 +- src/algorithm.rs | 4 ++-- src/engine.rs | 4 ++-- src/lib.rs | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index b8c63f3..29b9a93 100644 --- a/README.md +++ b/README.md @@ -38,7 +38,7 @@ let results = [ ]; // Calculate new rating after 1.0 rating periods -let new_rating = algorithm::rate_player(player, results.as_ref(), 1.0, parameters); +let new_rating = algorithm::rate_player(player, &results, 1.0, parameters); // The results are close to the results from the paper. assert!((new_rating.rating() - 1464.06).abs() < 0.01); diff --git a/src/algorithm.rs b/src/algorithm.rs index 3da6aad..a514c7d 100644 --- a/src/algorithm.rs +++ b/src/algorithm.rs @@ -510,8 +510,8 @@ mod test { PlayerResult::new(opponent_c, 0.0), ]; - let new_rating: Rating = super::rate_player(player, results.as_ref(), 1.0, parameters) - .into_with_parameters(parameters); + let new_rating: Rating = + super::rate_player(player, &results, 1.0, parameters).into_with_parameters(parameters); assert_approx_eq!(new_rating.rating(), 1464.06, 0.01); assert_approx_eq!(new_rating.deviation(), 151.52, 0.01); diff --git a/src/engine.rs b/src/engine.rs index 0d0866c..0d413a7 100644 --- a/src/engine.rs +++ b/src/engine.rs @@ -30,7 +30,7 @@ impl Player { /// The match results the player had in the current rating period. #[must_use] pub fn current_rating_period_results(&self) -> &[PlayerResult] { - self.current_rating_period_results.as_ref() + &self.current_rating_period_results } } @@ -74,7 +74,7 @@ impl ScaledPlayer { /// The match results the player had in the current rating period. #[must_use] pub fn current_rating_period_results(&self) -> &[ScaledPlayerResult] { - self.current_rating_period_results.as_ref() + &self.current_rating_period_results } } diff --git a/src/lib.rs b/src/lib.rs index ae59667..9cecde4 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -36,7 +36,7 @@ //! ]; //! //! // Calculate new rating after 1.0 rating periods -//! let new_rating = algorithm::rate_player(player, results.as_ref(), 1.0, parameters); +//! let new_rating = algorithm::rate_player(player, &results, 1.0, parameters); //! //! // The results are close to the results from the paper. //! assert!((new_rating.rating() - 1464.06).abs() < 0.01);