Simplify merge_opts
This commit is contained in:
parent
4eefbd93ad
commit
2e8f88b7a1
@ -335,11 +335,9 @@ trait Merge {
|
||||
fn merge(self, other: Self) -> Self;
|
||||
|
||||
fn merge_opts<T>(this: Option<T>, other: Option<T>) -> Option<T> {
|
||||
match (this, other) {
|
||||
(Some(t), Some(_)) => Some(t),
|
||||
(Some(t), None) => Some(t),
|
||||
(None, Some(o)) => Some(o),
|
||||
(None, None) => None,
|
||||
match &this {
|
||||
Some(_) => this,
|
||||
None => other,
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user