Simplify code
Some checks failed
Cargo CI / Build and Test (pull_request) Failing after 1m59s
Cargo CI / Lint (pull_request) Successful in 1m7s

This commit is contained in:
Wojciech Kozlowski 2024-10-06 15:21:14 +02:00
parent 9c2bbd2397
commit e6c440ecc5

View File

@ -47,13 +47,9 @@ pub enum MbRefOption<T> {
impl<T> MbRefOption<T> {
pub fn or(self, optb: MbRefOption<T>) -> MbRefOption<T> {
match self {
opta @ MbRefOption::Some(_) => opta,
opta @ MbRefOption::CannotHaveMbid => match optb {
MbRefOption::Some(_) => optb,
MbRefOption::CannotHaveMbid | MbRefOption::None => opta,
},
MbRefOption::None => optb,
match (&self, &optb) {
(MbRefOption::Some(_), _) | (MbRefOption::CannotHaveMbid, MbRefOption::None) => self,
_ => optb,
}
}