Simplify code
This commit is contained in:
parent
9c2bbd2397
commit
e6c440ecc5
@ -47,13 +47,9 @@ pub enum MbRefOption<T> {
|
|||||||
|
|
||||||
impl<T> MbRefOption<T> {
|
impl<T> MbRefOption<T> {
|
||||||
pub fn or(self, optb: MbRefOption<T>) -> MbRefOption<T> {
|
pub fn or(self, optb: MbRefOption<T>) -> MbRefOption<T> {
|
||||||
match self {
|
match (&self, &optb) {
|
||||||
opta @ MbRefOption::Some(_) => opta,
|
(MbRefOption::Some(_), _) | (MbRefOption::CannotHaveMbid, MbRefOption::None) => self,
|
||||||
opta @ MbRefOption::CannotHaveMbid => match optb {
|
_ => optb,
|
||||||
MbRefOption::Some(_) => optb,
|
|
||||||
MbRefOption::CannotHaveMbid | MbRefOption::None => opta,
|
|
||||||
},
|
|
||||||
MbRefOption::None => optb,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user