[librsvg] parse_or_value(): implement in terms of Option::unwrap_or()
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg] parse_or_value(): implement in terms of Option::unwrap_or()
- Date: Tue, 5 Sep 2017 15:15:43 +0000 (UTC)
commit 5409facf6dfa3deac900a53b9345b4bbd9657d30
Author: Federico Mena Quintero <federico gnome org>
Date: Tue Sep 5 10:10:41 2017 -0500
parse_or_value(): implement in terms of Option::unwrap_or()
rust/src/property_bag.rs | 8 +-------
1 files changed, 1 insertions(+), 7 deletions(-)
---
diff --git a/rust/src/property_bag.rs b/rust/src/property_bag.rs
index 0d32b3b..bdf9559 100644
--- a/rust/src/property_bag.rs
+++ b/rust/src/property_bag.rs
@@ -73,11 +73,5 @@ pub fn parse_or_value<T> (pbag: *const RsvgPropertyBag,
validate: Option<fn(T) -> Result<T, AttributeError>>) -> Result <T, NodeError>
where T: Parse<Err = AttributeError> + Copy
{
- let r = parse_or_none (pbag, key, data, validate);
-
- match r {
- Ok (Some (v)) => Ok (v),
- Ok (None) => Ok (value),
- Err (e) => Err (e)
- }
+ Ok (parse_or_none (pbag, key, data, validate)?.unwrap_or (value))
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]