made clippy happy

This commit is contained in:
MaxOhn
2022-06-21 07:38:50 +02:00
parent 80fe8aa238
commit d0db4a1775
6 changed files with 25 additions and 32 deletions
+18 -20
View File
@@ -441,30 +441,28 @@ impl Curve {
let catmull_detail = CATMULL_DETAIL as f32;
let subpath = (0..CATMULL_DETAIL)
.map(|c| {
let c = c as f32;
let t1 = c / catmull_detail;
let t2 = t1 * t1;
let t3 = t2 * t1;
let subpath = (0..CATMULL_DETAIL).flat_map(|c| {
let c = c as f32;
let t1 = c / catmull_detail;
let t2 = t1 * t1;
let t3 = t2 * t1;
let pos1 = Pos2 {
x: 0.5 * (x1 + x2 * t1 + x3 * t2 + x4 * t3),
y: 0.5 * (y1 + y2 * t1 + y3 * t2 + y4 * t3),
};
let pos1 = Pos2 {
x: 0.5 * (x1 + x2 * t1 + x3 * t2 + x4 * t3),
y: 0.5 * (y1 + y2 * t1 + y3 * t2 + y4 * t3),
};
let t1 = (c + 1.0) / catmull_detail;
let t2 = t1 * t1;
let t3 = t2 * t1;
let t1 = (c + 1.0) / catmull_detail;
let t2 = t1 * t1;
let t3 = t2 * t1;
let pos2 = Pos2 {
x: 0.5 * (x1 + x2 * t1 + x3 * t2 + x4 * t3),
y: 0.5 * (y1 + y2 * t1 + y3 * t2 + y4 * t3),
};
let pos2 = Pos2 {
x: 0.5 * (x1 + x2 * t1 + x3 * t2 + x4 * t3),
y: 0.5 * (y1 + y2 * t1 + y3 * t2 + y4 * t3),
};
iter::once(pos1).chain(iter::once(pos2))
})
.flatten();
iter::once(pos1).chain(iter::once(pos2))
});
path.extend(subpath);
}
+1 -1
View File
@@ -116,7 +116,7 @@ fn calculate_strain(params: ManiaStars<'_>) -> Strain {
clock_rate,
} = params;
let take = passed_objects.unwrap_or_else(|| map.hit_objects.len());
let take = passed_objects.unwrap_or(map.hit_objects.len());
let rounded_cs = map.cs.round();
let columns = match map.mode {
+1 -1
View File
@@ -235,7 +235,7 @@ fn calculate_skills(params: OsuStars<'_>) -> (Skills, OsuDifficultyAttributes) {
clock_rate,
} = params;
let take = passed_objects.unwrap_or_else(|| map.hit_objects.len());
let take = passed_objects.unwrap_or(map.hit_objects.len());
let clock_rate = clock_rate.unwrap_or_else(|| mods.clock_rate());
let map_attributes = map.attributes().mods(mods);
+3 -9
View File
@@ -176,9 +176,7 @@ impl<'map> OsuPP<'map> {
/// Be sure to set `misses` beforehand!
/// In case of a partial play, be also sure to set `passed_objects` beforehand!
pub fn accuracy(mut self, acc: f64) -> Self {
let n_objects = self
.passed_objects
.unwrap_or_else(|| self.map.hit_objects.len());
let n_objects = self.passed_objects.unwrap_or(self.map.hit_objects.len());
let mut acc = acc / 100.0;
@@ -241,9 +239,7 @@ impl<'map> OsuPP<'map> {
let mut n100 = self.n100;
let mut n50 = self.n50;
let n_objects = self
.passed_objects
.unwrap_or_else(|| self.map.hit_objects.len());
let n_objects = self.passed_objects.unwrap_or(self.map.hit_objects.len());
if let Some(acc) = self.acc {
let n300 = n300.unwrap_or(0);
@@ -267,9 +263,7 @@ impl<'map> OsuPP<'map> {
effective_misses,
}
} else {
let n_objects = self
.passed_objects
.unwrap_or_else(|| self.map.hit_objects.len());
let n_objects = self.passed_objects.unwrap_or(self.map.hit_objects.len());
let remaining = n_objects
.saturating_sub(n300.unwrap_or(0))
+1
View File
@@ -103,6 +103,7 @@ impl_reader!(async);
impl_reader!(async);
impl<R> FileReader<R> {
#[allow(clippy::wrong_self_convention)]
pub(crate) fn is_initial_empty_line(&mut self) -> bool {
if self.buf.starts_with(&[239, 187, 191]) {
// UTF-8
+1 -1
View File
@@ -169,7 +169,7 @@ fn calculate_skills(params: TaikoStars<'_>) -> (Skills, usize) {
clock_rate,
} = params;
let take = passed_objects.unwrap_or_else(|| map.hit_objects.len());
let take = passed_objects.unwrap_or(map.hit_objects.len());
let clock_rate = clock_rate.unwrap_or_else(|| mods.clock_rate());
// True if the object at that index is stamina cheese