From 2e8f88b7a1cd414cbaf5830ecf382050feeb9628 Mon Sep 17 00:00:00 2001 From: Wojciech Kozlowski Date: Sun, 21 May 2023 22:28:09 +0200 Subject: [PATCH] Simplify merge_opts --- src/lib.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index a6862eb..3980f2a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -335,11 +335,9 @@ trait Merge { fn merge(self, other: Self) -> Self; fn merge_opts(this: Option, other: Option) -> Option { - 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, } }