From e350b26600a42d6f4f384d60d8a7f75834878bb7 Mon Sep 17 00:00:00 2001 From: Erb3 <49862976+Erb3@users.noreply.github.com> Date: Sun, 7 Jul 2024 20:44:31 +0200 Subject: [PATCH 1/2] refactor: remove unnecessary floor --- src/utils.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/utils.rs b/src/utils.rs index a5cd09c..21a2964 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -1,5 +1,5 @@ pub(crate) fn calculate_score(kms: f64) -> u64 { - let kilometers = kms.floor() as u64; + let kilometers = kms as u64; if kilometers > 1500 { return 0; } @@ -12,7 +12,7 @@ mod tests { use super::*; #[test] - fn can_calculate_score() { + fn can_calculate_score() { assert_eq!(calculate_score(1500.0), 0); assert_eq!(calculate_score(1501.0), 0); assert_eq!(calculate_score(1504.0), 0); From fdaef8468b7e73351b6a507aba1eb393fb35f723 Mon Sep 17 00:00:00 2001 From: Erlend <49862976+Erb3@users.noreply.github.com> Date: Sun, 7 Jul 2024 20:46:28 +0200 Subject: [PATCH 2/2] refactor: fix ci Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- src/utils.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils.rs b/src/utils.rs index 21a2964..1b8f5f7 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -12,7 +12,7 @@ mod tests { use super::*; #[test] - fn can_calculate_score() { + fn can_calculate_score() { assert_eq!(calculate_score(1500.0), 0); assert_eq!(calculate_score(1501.0), 0); assert_eq!(calculate_score(1504.0), 0);