made clippy happy
This commit is contained in:
@@ -59,7 +59,7 @@ impl DifficultyPoint {
|
||||
pub fn new(time: f64, beat_len: f64, speed_multiplier: f64) -> Self {
|
||||
// * Note: In stable, the division occurs on floats, but with compiler optimisations
|
||||
// * turned on actually seems to occur on doubles via some .NET black magic (possibly inlining?).
|
||||
let bpm_multiplier = if beat_len < 0.0 {
|
||||
let bpm_mult = if beat_len < 0.0 {
|
||||
((-beat_len) as f32).clamp(10.0, 10_000.0) as f64 / 100.0
|
||||
} else {
|
||||
1.0
|
||||
@@ -68,7 +68,7 @@ impl DifficultyPoint {
|
||||
Self {
|
||||
time,
|
||||
slider_vel: speed_multiplier.clamp(0.1, 10.0),
|
||||
bpm_mult: bpm_multiplier as f64,
|
||||
bpm_mult,
|
||||
generate_ticks: !beat_len.is_nan(),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ impl Beatmap {
|
||||
7.0
|
||||
} else if percent_slider_or_spinner < 0.3 || rounded_cs >= 5.0 {
|
||||
(6 + (rounded_od > 5.0) as u8) as f32
|
||||
} else if percent_slider_or_spinner as f64 > 0.6 {
|
||||
} else if percent_slider_or_spinner > 0.6 {
|
||||
(4 + (rounded_od > 4.0) as u8) as f32
|
||||
} else {
|
||||
(rounded_od + 1.0).clamp(4.0, 7.0)
|
||||
|
||||
@@ -299,7 +299,7 @@ impl<'h> DistanceObjectPatternGenerator<'h> {
|
||||
let legacy = (4..=8).contains(&self.total_columns);
|
||||
let interval = self
|
||||
.random
|
||||
.gen_int_range(1, self.total_columns as i32 - (legacy as i32));
|
||||
.gen_int_range(1, self.total_columns - (legacy as i32));
|
||||
|
||||
let mut next_column = self.get_column(Some(true)) as i32;
|
||||
let random_start = self.random_start();
|
||||
|
||||
@@ -83,7 +83,7 @@ impl CatchObject {
|
||||
*last_excess = half_catcher_width;
|
||||
} else {
|
||||
self.hyper_dist = hyper_dist;
|
||||
*last_excess = (hyper_dist as f64).max(0.0).min(half_catcher_width);
|
||||
*last_excess = (hyper_dist as f64).clamp(0.0, half_catcher_width);
|
||||
}
|
||||
|
||||
*last_direction = this_direction;
|
||||
|
||||
@@ -82,9 +82,10 @@ impl Movement {
|
||||
.last_player_position
|
||||
.unwrap_or(current.last_normalized_pos);
|
||||
|
||||
let mut pos = last_player_pos
|
||||
.max(current.normalized_pos - POSITION_EPSILON)
|
||||
.min(current.normalized_pos + POSITION_EPSILON);
|
||||
let mut pos = last_player_pos.clamp(
|
||||
current.normalized_pos - POSITION_EPSILON,
|
||||
current.normalized_pos + POSITION_EPSILON,
|
||||
);
|
||||
|
||||
let dist_moved = pos - last_player_pos;
|
||||
let weighted_strain_time = current.strain_time + 13.0 + (3.0 / current.clock_rate);
|
||||
|
||||
+1
-3
@@ -431,9 +431,7 @@ impl CatchPPInner {
|
||||
if total_hits == 0 {
|
||||
1.0
|
||||
} else {
|
||||
(self.successful_hits() as f64 / total_hits as f64)
|
||||
.max(0.0)
|
||||
.min(1.0)
|
||||
(self.successful_hits() as f64 / total_hits as f64).clamp(0.0, 1.0)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -171,10 +171,14 @@ impl Distances {
|
||||
|
||||
let tail_jump_dist = (stacked_tail_pos - base.stacked_pos()).length() * scaling_factor;
|
||||
|
||||
this.min_jump_dist = (this.lazy_jump_dist
|
||||
- (Self::MAXIMUM_SLIDER_RADIUS - Self::ASSUMED_SLIDER_RADIUS) as f64)
|
||||
.min((tail_jump_dist - Self::MAXIMUM_SLIDER_RADIUS) as f64)
|
||||
.max(0.0);
|
||||
let diff = (Self::MAXIMUM_SLIDER_RADIUS - Self::ASSUMED_SLIDER_RADIUS) as f64;
|
||||
let min = (tail_jump_dist - Self::MAXIMUM_SLIDER_RADIUS) as f64;
|
||||
|
||||
// "attributes on expressions are experimental see issue #15701 https://github.com/rust-lang/rust/issues/15701"
|
||||
// rust pls...
|
||||
#[allow(clippy::manual_clamp)]
|
||||
let tmp = (this.lazy_jump_dist - diff).min(min).max(0.0);
|
||||
this.min_jump_dist = tmp;
|
||||
}
|
||||
|
||||
if let Some(last_last) = last_last.filter(|obj| !obj.is_spinner()) {
|
||||
|
||||
@@ -214,8 +214,7 @@ impl FlashlightEvaluator {
|
||||
let pixel_travel_dist = osu_curr.dists.lazy_travel_dist as f64 / scaling_factor;
|
||||
|
||||
// * Reward sliders based on velocity.
|
||||
slider_bonus = ((pixel_travel_dist / osu_curr.dists.travel_time as f64
|
||||
- Self::MIN_VELOCITY)
|
||||
slider_bonus = ((pixel_travel_dist / osu_curr.dists.travel_time - Self::MIN_VELOCITY)
|
||||
.max(0.0))
|
||||
.sqrt();
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ pub(crate) trait StrainSkill: Skill + Sized {
|
||||
) {
|
||||
// * The first object doesn't generate a strain, so we begin with an incremented section end
|
||||
if curr.idx == 0 {
|
||||
let section_len = SECTION_LEN as f64;
|
||||
let section_len = SECTION_LEN;
|
||||
*self.curr_section_end() = (curr.start_time / section_len).ceil() * section_len;
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ pub(crate) trait StrainSkill: Skill + Sized {
|
||||
self.start_new_section_from(section_end, curr, diff_objects);
|
||||
}
|
||||
|
||||
*self.curr_section_end() += SECTION_LEN as f64;
|
||||
*self.curr_section_end() += SECTION_LEN;
|
||||
}
|
||||
|
||||
*self.curr_section_peak() = self
|
||||
|
||||
+1
-1
@@ -713,7 +713,7 @@ fn parse_custom_sound(sound: &str) -> u8 {
|
||||
sound
|
||||
.bytes()
|
||||
.try_fold(0_u8, |sound, byte| match byte {
|
||||
b'0'..=b'9' => Some(sound.wrapping_mul(10).wrapping_add((byte & 0xF) as u8)),
|
||||
b'0'..=b'9' => Some(sound.wrapping_mul(10).wrapping_add(byte & 0xF)),
|
||||
_ => None,
|
||||
})
|
||||
.unwrap_or(0)
|
||||
|
||||
Reference in New Issue
Block a user