chore: made clippy happy

This commit is contained in:
MaxOhn
2024-10-11 21:14:37 +02:00
parent 915d07e94b
commit 25d8d295f3
10 changed files with 50 additions and 29 deletions
+3 -3
View File
@@ -178,9 +178,9 @@ impl Iterator for OsuGradualDifficulty {
DifficultyValues::eval(
&mut attrs,
self.difficulty.get_mods(),
aim_difficulty_value,
aim_no_sliders_difficulty_value,
speed_difficulty_value,
&aim_difficulty_value,
&aim_no_sliders_difficulty_value,
&speed_difficulty_value,
speed_relevant_note_count,
flashlight_difficulty_value,
);
+6 -6
View File
@@ -53,9 +53,9 @@ pub fn difficulty(difficulty: &Difficulty, converted: &OsuBeatmap<'_>) -> OsuDif
DifficultyValues::eval(
&mut attrs,
mods,
aim_difficulty_value,
aim_no_sliders_difficulty_value,
speed_difficulty_value,
&aim_difficulty_value,
&aim_no_sliders_difficulty_value,
&speed_difficulty_value,
speed_relevant_note_count,
flashlight_difficulty_value,
);
@@ -151,9 +151,9 @@ impl DifficultyValues {
pub fn eval(
attrs: &mut OsuDifficultyAttributes,
mods: &GameMods,
aim: UsedOsuStrainSkills<DifficultyValue>,
aim_no_sliders: UsedOsuStrainSkills<DifficultyValue>,
speed: UsedOsuStrainSkills<DifficultyValue>,
aim: &UsedOsuStrainSkills<DifficultyValue>,
aim_no_sliders: &UsedOsuStrainSkills<DifficultyValue>,
speed: &UsedOsuStrainSkills<DifficultyValue>,
speed_relevant_note_count: f64,
flashlight_difficulty_value: f64,
) {
+3 -2
View File
@@ -203,6 +203,7 @@ impl RhythmEvaluator {
const RHYTHM_OVERALL_MULTIPLIER: f64 = 0.95;
const RHYTHM_RATIO_MULTIPLIER: f64 = 12.0;
#[allow(clippy::too_many_lines)]
fn evaluate_diff_of<'a>(
curr: &'a OsuDifficultyObject<'a>,
diff_objects: &'a [OsuDifficultyObject<'a>],
@@ -409,7 +410,7 @@ const _: [(); 0 - !{ MIN_DELTA_TIME - OsuDifficultyObject::MIN_DELTA_TIME as i32
[];
impl RhythmIsland {
fn new(delta_difference_eps: f64) -> Self {
const fn new(delta_difference_eps: f64) -> Self {
Self {
delta_difference_eps,
delta: 0,
@@ -433,7 +434,7 @@ impl RhythmIsland {
self.delta_count += 1;
}
fn is_similar_polarity(&self, other: &Self) -> bool {
const fn is_similar_polarity(&self, other: &Self) -> bool {
// * TODO: consider islands to be of similar polarity only if they're having the same average delta (we don't want to consider 3 singletaps similar to a triple)
// * naively adding delta check here breaks _a lot_ of maps because of the flawed ratio calculation
self.delta_count % 2 == other.delta_count % 2
+2 -2
View File
@@ -11,7 +11,7 @@ impl Default for OsuStrainSkill {
Self {
// mean=406.72 | median=307
object_strains: Vec::with_capacity(256),
inner: Default::default(),
inner: StrainSkill::default(),
}
}
}
@@ -90,7 +90,7 @@ pub struct UsedOsuStrainSkills<T> {
}
impl UsedOsuStrainSkills<DifficultyValue> {
pub fn difficulty_value(&self) -> f64 {
pub const fn difficulty_value(&self) -> f64 {
self.value.0
}
+3 -3
View File
@@ -645,7 +645,7 @@ impl OsuPerformanceInner<'_> {
aim_value *= len_bonus;
if self.effective_miss_count > 0.0 {
aim_value *= self.calculate_miss_penalty(
aim_value *= Self::calculate_miss_penalty(
self.effective_miss_count,
self.attrs.aim_difficult_strain_count,
);
@@ -714,7 +714,7 @@ impl OsuPerformanceInner<'_> {
speed_value *= len_bonus;
if self.effective_miss_count > 0.0 {
speed_value *= self.calculate_miss_penalty(
speed_value *= Self::calculate_miss_penalty(
self.effective_miss_count,
self.attrs.speed_difficult_strain_count,
);
@@ -857,7 +857,7 @@ impl OsuPerformanceInner<'_> {
// * Miss penalty assumes that a player will miss on the hardest parts of a map,
// * so we use the amount of relatively difficult sections to adjust miss penalty
// * to make it more punishing on maps with lower amount of hard sections.
fn calculate_miss_penalty(&self, miss_count: f64, diff_strain_count: f64) -> f64 {
fn calculate_miss_penalty(miss_count: f64, diff_strain_count: f64) -> f64 {
0.96 / ((miss_count / (4.0 * diff_strain_count.ln().powf(0.94))) + 1.0)
}