chore: made clippy happy

This commit is contained in:
MaxOhn
2024-09-30 23:58:21 +02:00
parent 092cf34eb4
commit f9dfa5e35c
8 changed files with 37 additions and 39 deletions
+2 -2
View File
@@ -27,8 +27,8 @@ impl<'map> Performance<'map> {
/// ///
/// The argument `map_or_attrs` must be either /// The argument `map_or_attrs` must be either
/// - previously calculated attributes ([`DifficultyAttributes`], /// - previously calculated attributes ([`DifficultyAttributes`],
/// [`PerformanceAttributes`], or mode-specific attributes like /// [`PerformanceAttributes`], or mode-specific attributes like
/// [`TaikoDifficultyAttributes`], [`ManiaPerformanceAttributes`], ...) /// [`TaikoDifficultyAttributes`], [`ManiaPerformanceAttributes`], ...)
/// - a beatmap ([`Beatmap`] or [`Converted<'_, M>`]) /// - a beatmap ([`Beatmap`] or [`Converted<'_, M>`])
/// ///
/// If a map is given, difficulty attributes will need to be calculated /// If a map is given, difficulty attributes will need to be calculated
+12 -12
View File
@@ -44,18 +44,6 @@ impl<'a> JuiceStream<'a> {
let path = slider.curve(GameMode::Catch, &mut bufs.curve); let path = slider.curve(GameMode::Catch, &mut bufs.curve);
fn get_precision_adjusted_beat_len(slider_velocity_multiplier: f64, beat_len: f64) -> f64 {
let slider_velocity_as_beat_len = -100.0 / slider_velocity_multiplier;
let bpm_multiplier = if slider_velocity_as_beat_len < 0.0 {
f64::from(((-slider_velocity_as_beat_len) as f32).clamp(10.0, 10_000.0)) / 100.0
} else {
1.0
};
beat_len * bpm_multiplier
}
let velocity = JuiceStream::BASE_SCORING_DIST * slider_multiplier let velocity = JuiceStream::BASE_SCORING_DIST * slider_multiplier
/ get_precision_adjusted_beat_len(slider_velocity, beat_len); / get_precision_adjusted_beat_len(slider_velocity, beat_len);
let scoring_dist = velocity * beat_len; let scoring_dist = velocity * beat_len;
@@ -171,3 +159,15 @@ pub struct JuiceStreamBufs {
pub curve: CurveBuffers, pub curve: CurveBuffers,
pub ticks: Vec<SliderEvent>, pub ticks: Vec<SliderEvent>,
} }
fn get_precision_adjusted_beat_len(slider_velocity_multiplier: f64, beat_len: f64) -> f64 {
let slider_velocity_as_beat_len = -100.0 / slider_velocity_multiplier;
let bpm_multiplier = if slider_velocity_as_beat_len < 0.0 {
f64::from(((-slider_velocity_as_beat_len) as f32).clamp(10.0, 10_000.0)) / 100.0
} else {
1.0
};
beat_len * bpm_multiplier
}
+1 -1
View File
@@ -36,7 +36,7 @@ impl<'map> CatchPerformance<'map> {
/// ///
/// The argument `map_or_attrs` must be either /// The argument `map_or_attrs` must be either
/// - previously calculated attributes ([`CatchDifficultyAttributes`] /// - previously calculated attributes ([`CatchDifficultyAttributes`]
/// or [`CatchPerformanceAttributes`]) /// or [`CatchPerformanceAttributes`])
/// - a beatmap ([`CatchBeatmap<'map>`]) /// - a beatmap ([`CatchBeatmap<'map>`])
/// ///
/// If a map is given, difficulty attributes will need to be calculated /// If a map is given, difficulty attributes will need to be calculated
+1 -1
View File
@@ -37,7 +37,7 @@ impl<'map> ManiaPerformance<'map> {
/// ///
/// The argument `map_or_attrs` must be either /// The argument `map_or_attrs` must be either
/// - previously calculated attributes ([`ManiaDifficultyAttributes`] /// - previously calculated attributes ([`ManiaDifficultyAttributes`]
/// or [`ManiaPerformanceAttributes`]) /// or [`ManiaPerformanceAttributes`])
/// - a beatmap ([`ManiaBeatmap<'map>`]) /// - a beatmap ([`ManiaBeatmap<'map>`])
/// ///
/// If a map is given, difficulty attributes will need to be calculated /// If a map is given, difficulty attributes will need to be calculated
+1 -1
View File
@@ -196,7 +196,7 @@ impl SpeedEvaluator {
let difficulty = speed_bonus * dist_bonus * 1000.0 / strain_time; let difficulty = speed_bonus * dist_bonus * 1000.0 / strain_time;
// * Apply penalty if there's doubletappable doubles // * Apply penalty if there's doubletappable doubles
return difficulty * doubletapness; difficulty * doubletapness
} }
} }
+18 -20
View File
@@ -142,7 +142,7 @@ impl OsuObject {
self.end_pos() + self.stack_offset self.end_pos() + self.stack_offset
} }
pub fn lazy_travel_time(&self) -> f64 { pub const fn lazy_travel_time(&self) -> f64 {
match self.kind { match self.kind {
OsuObjectKind::Circle | OsuObjectKind::Spinner(_) => 0.0, OsuObjectKind::Circle | OsuObjectKind::Spinner(_) => 0.0,
OsuObjectKind::Slider(ref slider) => slider.lazy_travel_time, OsuObjectKind::Slider(ref slider) => slider.lazy_travel_time,
@@ -207,18 +207,6 @@ impl OsuSlider {
let span_count = slider.span_count() as f64; let span_count = slider.span_count() as f64;
fn get_precision_adjusted_beat_len(slider_velocity_multiplier: f64, beat_len: f64) -> f64 {
let slider_velocity_as_beat_len = -100.0 / slider_velocity_multiplier;
let bpm_multiplier = if slider_velocity_as_beat_len < 0.0 {
f64::from(((-slider_velocity_as_beat_len) as f32).clamp(10.0, 10_000.0)) / 100.0
} else {
1.0
};
beat_len * bpm_multiplier
}
let velocity = f64::from(OsuObject::BASE_SCORING_DIST) * slider_multiplier let velocity = f64::from(OsuObject::BASE_SCORING_DIST) * slider_multiplier
/ get_precision_adjusted_beat_len(slider_velocity, beat_len); / get_precision_adjusted_beat_len(slider_velocity, beat_len);
let scoring_dist = velocity * beat_len; let scoring_dist = velocity * beat_len;
@@ -277,13 +265,11 @@ impl OsuSlider {
start_time: start_time + f64::from(e.span_idx + 1) * span_duration, start_time: start_time + f64::from(e.span_idx + 1) * span_duration,
kind: NestedSliderObjectKind::Repeat, kind: NestedSliderObjectKind::Repeat,
}, },
SliderEventType::Tail => { SliderEventType::Tail => NestedSliderObject {
NestedSliderObject { pos: end_path_pos, // no `h.pos` yet to keep order of float operations
pos: end_path_pos, // no `h.pos` yet to keep order of float operations start_time: e.time,
start_time: e.time, kind: NestedSliderObjectKind::Tail,
kind: NestedSliderObjectKind::Tail, },
}
}
SliderEventType::Head | SliderEventType::LastTick => return None, SliderEventType::Head | SliderEventType::LastTick => return None,
}; };
@@ -399,3 +385,15 @@ pub enum NestedSliderObjectKind {
Tail, Tail,
Tick, Tick,
} }
fn get_precision_adjusted_beat_len(slider_velocity_multiplier: f64, beat_len: f64) -> f64 {
let slider_velocity_as_beat_len = -100.0 / slider_velocity_multiplier;
let bpm_multiplier = if slider_velocity_as_beat_len < 0.0 {
f64::from(((-slider_velocity_as_beat_len) as f32).clamp(10.0, 10_000.0)) / 100.0
} else {
1.0
};
beat_len * bpm_multiplier
}
+1 -1
View File
@@ -40,7 +40,7 @@ impl<'map> OsuPerformance<'map> {
/// ///
/// The argument `map_or_attrs` must be either /// The argument `map_or_attrs` must be either
/// - previously calculated attributes ([`OsuDifficultyAttributes`] /// - previously calculated attributes ([`OsuDifficultyAttributes`]
/// or [`OsuPerformanceAttributes`]) /// or [`OsuPerformanceAttributes`])
/// - a beatmap ([`OsuBeatmap<'map>`]) /// - a beatmap ([`OsuBeatmap<'map>`])
/// ///
/// If a map is given, difficulty attributes will need to be calculated /// If a map is given, difficulty attributes will need to be calculated
+1 -1
View File
@@ -35,7 +35,7 @@ impl<'map> TaikoPerformance<'map> {
/// ///
/// The argument `map_or_attrs` must be either /// The argument `map_or_attrs` must be either
/// - previously calculated attributes ([`TaikoDifficultyAttributes`] /// - previously calculated attributes ([`TaikoDifficultyAttributes`]
/// or [`TaikoPerformanceAttributes`]) /// or [`TaikoPerformanceAttributes`])
/// - a beatmap ([`TaikoBeatmap<'map>`]) /// - a beatmap ([`TaikoBeatmap<'map>`])
/// ///
/// If a map is given, difficulty attributes will need to be calculated /// If a map is given, difficulty attributes will need to be calculated