chore: made clippy happy

This commit is contained in:
MaxOhn
2023-12-29 11:49:13 +01:00
parent d9bf3240eb
commit fecc3b1941
3 changed files with 5 additions and 8 deletions
+2 -2
View File
@@ -229,7 +229,7 @@ impl<'map> ManiaPP<'map> {
pub fn generate_state(&mut self) -> ManiaScoreState { pub fn generate_state(&mut self) -> ManiaScoreState {
let attrs = match self.map_or_attrs { let attrs = match self.map_or_attrs {
MapOrElse::Map(ref map) => { MapOrElse::Map(ref map) => {
let attrs = self.generate_attributes(&map); let attrs = self.generate_attributes(map);
self.map_or_attrs.else_or_insert(attrs) self.map_or_attrs.else_or_insert(attrs)
} }
@@ -728,7 +728,7 @@ impl<'map> ManiaPP<'map> {
fn generate_attributes(&self, map: &Beatmap) -> ManiaDifficultyAttributes { fn generate_attributes(&self, map: &Beatmap) -> ManiaDifficultyAttributes {
let is_convert = self let is_convert = self
.is_convert_overwrite .is_convert_overwrite
.unwrap_or_else(|| match self.map_or_attrs { .unwrap_or(match self.map_or_attrs {
MapOrElse::Map(ref map) => matches!(map, Cow::Owned(_)), MapOrElse::Map(ref map) => matches!(map, Cow::Owned(_)),
MapOrElse::Else(ref attrs) => attrs.is_convert, MapOrElse::Else(ref attrs) => attrs.is_convert,
}); });
+2 -2
View File
@@ -200,7 +200,7 @@ impl<'map> TaikoPP<'map> {
pub fn generate_state(&mut self) -> TaikoScoreState { pub fn generate_state(&mut self) -> TaikoScoreState {
let attrs = match self.map_or_attrs { let attrs = match self.map_or_attrs {
MapOrElse::Map(ref map) => { MapOrElse::Map(ref map) => {
let attrs = self.generate_attributes(&map); let attrs = self.generate_attributes(map);
self.map_or_attrs.else_or_insert(attrs) self.map_or_attrs.else_or_insert(attrs)
} }
@@ -308,7 +308,7 @@ impl<'map> TaikoPP<'map> {
fn generate_attributes(&self, map: &Beatmap) -> TaikoDifficultyAttributes { fn generate_attributes(&self, map: &Beatmap) -> TaikoDifficultyAttributes {
let is_convert = self let is_convert = self
.is_convert_overwrite .is_convert_overwrite
.unwrap_or_else(|| match self.map_or_attrs { .unwrap_or(match self.map_or_attrs {
MapOrElse::Map(ref map) => matches!(map, Cow::Owned(_)), MapOrElse::Map(ref map) => matches!(map, Cow::Owned(_)),
MapOrElse::Else(ref attrs) => attrs.is_convert, MapOrElse::Else(ref attrs) => attrs.is_convert,
}); });
+1 -4
View File
@@ -6,10 +6,7 @@ pub(crate) enum MapOrElse<M, E> {
Else(E), Else(E),
} }
impl<M, E> MapOrElse<M, E> impl<M, E> MapOrElse<M, E> {
where
M: AsRef<Beatmap>,
{
/// Return a mutable reference to `Else`. /// Return a mutable reference to `Else`.
/// ///
/// If `self` is of variant `Map`, store `other` in `self`, and return a /// If `self` is of variant `Map`, store `other` in `self`, and return a