rename method

This commit is contained in:
MaxOhn
2024-02-27 12:58:50 +01:00
parent f173a51c0e
commit 5d77e246ae
5 changed files with 8 additions and 11 deletions
+4 -7
View File
@@ -12,21 +12,18 @@ impl<'map, M: IGameMode> MapOrAttrs<'map, M> {
///
/// If `self` is of variant `Map`, store `attrs` in `self`, and return a
/// mutable reference to it.
pub fn attrs_or_insert(
&mut self,
attrs: M::DifficultyAttributes,
) -> &mut M::DifficultyAttributes {
pub fn insert_attrs(&mut self, attrs: M::DifficultyAttributes) -> &mut M::DifficultyAttributes {
match self {
MapOrAttrs::Map(_) => {
*self = Self::Attrs(attrs);
let Self::Attrs(ref mut other) = self else {
let Self::Attrs(ref mut attrs) = self else {
unreachable!()
};
other
attrs
}
MapOrAttrs::Attrs(ref mut other) => other,
MapOrAttrs::Attrs(ref mut attrs) => attrs,
}
}
}