chore: made clippy happy
This commit is contained in:
@@ -200,7 +200,7 @@ fn target_columns(map: &Beatmap) -> f32 {
|
|||||||
|
|
||||||
// * In osu!stable, this division appears as if it happens on floats, but due to release-mode
|
// * In osu!stable, this division appears as if it happens on floats, but due to release-mode
|
||||||
// * optimisations, it actually ends up happening on doubles.
|
// * optimisations, it actually ends up happening on doubles.
|
||||||
let percent_slider_or_spinner = f64::from(count_slider_or_spinner as f64 / len as f64);
|
let percent_slider_or_spinner = count_slider_or_spinner as f64 / len as f64;
|
||||||
|
|
||||||
if percent_slider_or_spinner < 0.2 {
|
if percent_slider_or_spinner < 0.2 {
|
||||||
return 7.0;
|
return 7.0;
|
||||||
@@ -211,5 +211,9 @@ fn target_columns(map: &Beatmap) -> f32 {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Keeping it in-sync with lazer
|
||||||
|
#[allow(clippy::manual_clamp)]
|
||||||
|
{
|
||||||
((rounded_od as i32) + 1).min(7).max(4) as f32
|
((rounded_od as i32) + 1).min(7).max(4) as f32
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -382,6 +382,8 @@ impl<M> From<&Converted<'_, M>> for BeatmapAttributesBuilder {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// False positive? Value looks consumed to me...
|
||||||
|
#[allow(clippy::needless_pass_by_value)]
|
||||||
fn difficulty_range(difficulty: f64, windows: GameModeHitWindows) -> f64 {
|
fn difficulty_range(difficulty: f64, windows: GameModeHitWindows) -> f64 {
|
||||||
let GameModeHitWindows { min, avg: mid, max } = windows;
|
let GameModeHitWindows { min, avg: mid, max } = windows;
|
||||||
|
|
||||||
|
|||||||
@@ -178,9 +178,9 @@ impl Iterator for OsuGradualDifficulty {
|
|||||||
DifficultyValues::eval(
|
DifficultyValues::eval(
|
||||||
&mut attrs,
|
&mut attrs,
|
||||||
self.difficulty.get_mods(),
|
self.difficulty.get_mods(),
|
||||||
aim_difficulty_value,
|
&aim_difficulty_value,
|
||||||
aim_no_sliders_difficulty_value,
|
&aim_no_sliders_difficulty_value,
|
||||||
speed_difficulty_value,
|
&speed_difficulty_value,
|
||||||
speed_relevant_note_count,
|
speed_relevant_note_count,
|
||||||
flashlight_difficulty_value,
|
flashlight_difficulty_value,
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -53,9 +53,9 @@ pub fn difficulty(difficulty: &Difficulty, converted: &OsuBeatmap<'_>) -> OsuDif
|
|||||||
DifficultyValues::eval(
|
DifficultyValues::eval(
|
||||||
&mut attrs,
|
&mut attrs,
|
||||||
mods,
|
mods,
|
||||||
aim_difficulty_value,
|
&aim_difficulty_value,
|
||||||
aim_no_sliders_difficulty_value,
|
&aim_no_sliders_difficulty_value,
|
||||||
speed_difficulty_value,
|
&speed_difficulty_value,
|
||||||
speed_relevant_note_count,
|
speed_relevant_note_count,
|
||||||
flashlight_difficulty_value,
|
flashlight_difficulty_value,
|
||||||
);
|
);
|
||||||
@@ -151,9 +151,9 @@ impl DifficultyValues {
|
|||||||
pub fn eval(
|
pub fn eval(
|
||||||
attrs: &mut OsuDifficultyAttributes,
|
attrs: &mut OsuDifficultyAttributes,
|
||||||
mods: &GameMods,
|
mods: &GameMods,
|
||||||
aim: UsedOsuStrainSkills<DifficultyValue>,
|
aim: &UsedOsuStrainSkills<DifficultyValue>,
|
||||||
aim_no_sliders: UsedOsuStrainSkills<DifficultyValue>,
|
aim_no_sliders: &UsedOsuStrainSkills<DifficultyValue>,
|
||||||
speed: UsedOsuStrainSkills<DifficultyValue>,
|
speed: &UsedOsuStrainSkills<DifficultyValue>,
|
||||||
speed_relevant_note_count: f64,
|
speed_relevant_note_count: f64,
|
||||||
flashlight_difficulty_value: f64,
|
flashlight_difficulty_value: f64,
|
||||||
) {
|
) {
|
||||||
|
|||||||
@@ -214,6 +214,7 @@ impl RhythmEvaluator {
|
|||||||
const RHYTHM_OVERALL_MULTIPLIER: f64 = 0.95;
|
const RHYTHM_OVERALL_MULTIPLIER: f64 = 0.95;
|
||||||
const RHYTHM_RATIO_MULTIPLIER: f64 = 12.0;
|
const RHYTHM_RATIO_MULTIPLIER: f64 = 12.0;
|
||||||
|
|
||||||
|
#[allow(clippy::too_many_lines)]
|
||||||
fn evaluate_diff_of<'a>(
|
fn evaluate_diff_of<'a>(
|
||||||
curr: &'a OsuDifficultyObject<'a>,
|
curr: &'a OsuDifficultyObject<'a>,
|
||||||
diff_objects: &'a [OsuDifficultyObject<'a>],
|
diff_objects: &'a [OsuDifficultyObject<'a>],
|
||||||
@@ -420,7 +421,7 @@ const _: [(); 0 - !{ MIN_DELTA_TIME - OsuDifficultyObject::MIN_DELTA_TIME as i32
|
|||||||
[];
|
[];
|
||||||
|
|
||||||
impl RhythmIsland {
|
impl RhythmIsland {
|
||||||
fn new(delta_difference_eps: f64) -> Self {
|
const fn new(delta_difference_eps: f64) -> Self {
|
||||||
Self {
|
Self {
|
||||||
delta_difference_eps,
|
delta_difference_eps,
|
||||||
delta: 0,
|
delta: 0,
|
||||||
@@ -444,7 +445,7 @@ impl RhythmIsland {
|
|||||||
self.delta_count += 1;
|
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)
|
// * 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
|
// * naively adding delta check here breaks _a lot_ of maps because of the flawed ratio calculation
|
||||||
self.delta_count % 2 == other.delta_count % 2
|
self.delta_count % 2 == other.delta_count % 2
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ impl Default for OsuStrainSkill {
|
|||||||
Self {
|
Self {
|
||||||
// mean=406.72 | median=307
|
// mean=406.72 | median=307
|
||||||
object_strains: Vec::with_capacity(256),
|
object_strains: Vec::with_capacity(256),
|
||||||
inner: Default::default(),
|
inner: StrainSkill::default(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -90,7 +90,7 @@ pub struct UsedOsuStrainSkills<T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl UsedOsuStrainSkills<DifficultyValue> {
|
impl UsedOsuStrainSkills<DifficultyValue> {
|
||||||
pub fn difficulty_value(&self) -> f64 {
|
pub const fn difficulty_value(&self) -> f64 {
|
||||||
self.value.0
|
self.value.0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -649,7 +649,7 @@ impl OsuPerformanceInner<'_> {
|
|||||||
aim_value *= len_bonus;
|
aim_value *= len_bonus;
|
||||||
|
|
||||||
if self.effective_miss_count > 0.0 {
|
if self.effective_miss_count > 0.0 {
|
||||||
aim_value *= self.calculate_miss_penalty(
|
aim_value *= Self::calculate_miss_penalty(
|
||||||
self.effective_miss_count,
|
self.effective_miss_count,
|
||||||
self.attrs.aim_difficult_strain_count,
|
self.attrs.aim_difficult_strain_count,
|
||||||
);
|
);
|
||||||
@@ -718,7 +718,7 @@ impl OsuPerformanceInner<'_> {
|
|||||||
speed_value *= len_bonus;
|
speed_value *= len_bonus;
|
||||||
|
|
||||||
if self.effective_miss_count > 0.0 {
|
if self.effective_miss_count > 0.0 {
|
||||||
speed_value *= self.calculate_miss_penalty(
|
speed_value *= Self::calculate_miss_penalty(
|
||||||
self.effective_miss_count,
|
self.effective_miss_count,
|
||||||
self.attrs.speed_difficult_strain_count,
|
self.attrs.speed_difficult_strain_count,
|
||||||
);
|
);
|
||||||
@@ -863,7 +863,7 @@ impl OsuPerformanceInner<'_> {
|
|||||||
// * Miss penalty assumes that a player will miss on the hardest parts of a map,
|
// * 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
|
// * 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.
|
// * 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)
|
0.96 / ((miss_count / (4.0 * diff_strain_count.ln().powf(0.94))) + 1.0)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -174,7 +174,7 @@ struct SliderParams<'c> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl<'c> SliderParams<'c> {
|
impl<'c> SliderParams<'c> {
|
||||||
fn new(start_time: f64, slider: &'c Slider) -> Self {
|
const fn new(start_time: f64, slider: &'c Slider) -> Self {
|
||||||
Self {
|
Self {
|
||||||
slider,
|
slider,
|
||||||
start_time,
|
start_time,
|
||||||
|
|||||||
@@ -511,6 +511,7 @@ impl TaikoPerformanceInner<'_> {
|
|||||||
let h100 = self.attrs.ok_hit_window;
|
let h100 = self.attrs.ok_hit_window;
|
||||||
let n = self.total_hits();
|
let n = self.total_hits();
|
||||||
|
|
||||||
|
#[allow(clippy::items_after_statements, clippy::unreadable_literal)]
|
||||||
// * 99% critical value for the normal distribution (one-tailed).
|
// * 99% critical value for the normal distribution (one-tailed).
|
||||||
const Z: f64 = 2.32634787404;
|
const Z: f64 = 2.32634787404;
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,10 @@
|
|||||||
|
#![allow(
|
||||||
|
clippy::excessive_precision,
|
||||||
|
clippy::too_many_lines,
|
||||||
|
clippy::unreadable_literal,
|
||||||
|
clippy::many_single_char_names
|
||||||
|
)]
|
||||||
|
|
||||||
#[rustfmt::skip]
|
#[rustfmt::skip]
|
||||||
mod consts {
|
mod consts {
|
||||||
pub const ERF_IMP_AN: &[f64] = &[ 0.00337916709551257388990745, -0.00073695653048167948530905, -0.374732337392919607868241, 0.0817442448733587196071743, -0.0421089319936548595203468, 0.0070165709512095756344528, -0.00495091255982435110337458, 0.000871646599037922480317225 ];
|
pub const ERF_IMP_AN: &[f64] = &[ 0.00337916709551257388990745, -0.00073695653048167948530905, -0.374732337392919607868241, 0.0817442448733587196071743, -0.0421089319936548595203468, 0.0070165709512095756344528, -0.00495091255982435110337458, 0.000871646599037922480317225 ];
|
||||||
@@ -45,6 +52,7 @@ mod consts {
|
|||||||
pub const ERV_INV_IMP_GD: &[f64] = &[ 1.0, 0.0845746234001899436914, 0.00282092984726264681981, 0.468292921940894236786e-4, 0.399968812193862100054e-6, 0.161809290887904476097e-8, 0.231558608310259605225e-11 ];
|
pub const ERV_INV_IMP_GD: &[f64] = &[ 1.0, 0.0845746234001899436914, 0.00282092984726264681981, 0.468292921940894236786e-4, 0.399968812193862100054e-6, 0.161809290887904476097e-8, 0.231558608310259605225e-11 ];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(clippy::wildcard_imports)]
|
||||||
use consts::*;
|
use consts::*;
|
||||||
|
|
||||||
pub fn erf(x: f64) -> f64 {
|
pub fn erf(x: f64) -> f64 {
|
||||||
|
|||||||
Reference in New Issue
Block a user