use cmp methods

This commit is contained in:
MaxOhn
2024-02-26 18:07:16 +01:00
parent c2c617ec01
commit e81c0e890f
15 changed files with 76 additions and 48 deletions
+2 -2
View File
@@ -1,4 +1,4 @@
use std::mem;
use std::{cmp, mem};
use crate::{
any::difficulty::skills::Skill,
@@ -201,7 +201,7 @@ impl Iterator for OsuGradualDifficulty {
fn nth(&mut self, n: usize) -> Option<Self::Item> {
let skip_iter = self.diff_objects.iter().skip(self.idx.saturating_sub(1));
let mut take = n.min(self.len().saturating_sub(1));
let mut take = cmp::min(n, self.len().saturating_sub(1));
// The first note has no difficulty object
if self.idx == 0 && take > 0 {
+3 -1
View File
@@ -1,3 +1,5 @@
use std::cmp;
use crate::{
any::difficulty::{
object::IDifficultyObject,
@@ -155,7 +157,7 @@ impl FlashlightEvaluator {
let mut angle_repeat_count = 0.0;
// * This is iterating backwards in time from the current object.
for i in 0..curr.idx.min(10) {
for i in 0..cmp::min(curr.idx, 10) {
let Some(curr_obj) = curr.previous(i, diff_objects) else {
break;
};
+2 -2
View File
@@ -1,4 +1,4 @@
use std::f64::consts::PI;
use std::{cmp, f64::consts::PI};
use crate::{
any::difficulty::{
@@ -217,7 +217,7 @@ impl RhythmEvaluator {
let mut first_delta_switch = false;
let historical_note_count = curr.idx.min(32);
let historical_note_count = cmp::min(curr.idx, 32);
let mut rhythm_start = 0;