Skip to content

Commit

Permalink
Remove outdated as_refs
Browse files Browse the repository at this point in the history
  • Loading branch information
gpluscb committed Mar 31, 2022
1 parent 0e5c95f commit 67c2933
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions src/algorithm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions src/engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}

Expand Down Expand Up @@ -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
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 67c2933

Please sign in to comment.