[librsvg: 8/10] Shorten Node.set_atts() with a chain of .and_then()
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg: 8/10] Shorten Node.set_atts() with a chain of .and_then()
- Date: Thu, 2 May 2019 15:34:30 +0000 (UTC)
commit 699ab8e0440ae6ea24be00cd57a135052d9a33cf
Author: Federico Mena Quintero <federico gnome org>
Date: Thu May 2 09:30:05 2019 -0500
Shorten Node.set_atts() with a chain of .and_then()
rsvg_internals/src/node.rs | 23 +++++------------------
1 file changed, 5 insertions(+), 18 deletions(-)
---
diff --git a/rsvg_internals/src/node.rs b/rsvg_internals/src/node.rs
index c1b5b9b1..b4abbc90 100644
--- a/rsvg_internals/src/node.rs
+++ b/rsvg_internals/src/node.rs
@@ -367,25 +367,12 @@ impl Node {
}
pub fn set_atts(&self, node: &RsvgNode, pbag: &PropertyBag<'_>, locale: &Locale) {
- if let Err(e) = self.set_transform_attribute(pbag) {
+ if let Err(e) = self
+ .set_transform_attribute(pbag)
+ .and_then(|_| self.parse_conditional_processing_attributes(pbag, locale))
+ .and_then(|_| self.data.node_impl.set_atts(node, pbag))
+ {
self.set_error(e);
- return;
- }
-
- match self.parse_conditional_processing_attributes(pbag, locale) {
- Ok(_) => (),
- Err(e) => {
- self.set_error(e);
- return;
- }
- }
-
- match self.data.node_impl.set_atts(node, pbag) {
- Ok(_) => (),
- Err(e) => {
- self.set_error(e);
- return;
- }
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]