[librsvg: 14/43] pattern: prefer or_else
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg: 14/43] pattern: prefer or_else
- Date: Tue, 15 Oct 2019 00:06:39 +0000 (UTC)
commit 8ee9bd612be8b60f1b84af29e2243691a2b0081c
Author: Paolo Borelli <pborelli gnome org>
Date: Sun Oct 13 12:21:58 2019 +0200
pattern: prefer or_else
rsvg_internals/src/pattern.rs | 19 +++++++++++--------
1 file changed, 11 insertions(+), 8 deletions(-)
---
diff --git a/rsvg_internals/src/pattern.rs b/rsvg_internals/src/pattern.rs
index 182fed2f..a38e14a9 100644
--- a/rsvg_internals/src/pattern.rs
+++ b/rsvg_internals/src/pattern.rs
@@ -471,21 +471,24 @@ impl UnresolvedPattern {
}
fn resolve_from_defaults(&self) -> UnresolvedPattern {
- let units = self.common.units.or(Some(PatternUnits::default()));
+ let units = self.common.units.or_else(|| Some(PatternUnits::default()));
let content_units = self
.common
.content_units
- .or(Some(PatternContentUnits::default()));
+ .or_else(|| Some(PatternContentUnits::default()));
let vbox = self.common.vbox.or(Some(None));
let preserve_aspect_ratio = self
.common
.preserve_aspect_ratio
- .or(Some(AspectRatio::default()));
- let affine = self.common.affine.or(Some(cairo::Matrix::identity()));
- let x = self.common.x.or(Some(Default::default()));
- let y = self.common.y.or(Some(Default::default()));
- let width = self.common.width.or(Some(Default::default()));
- let height = self.common.height.or(Some(Default::default()));
+ .or_else(|| Some(AspectRatio::default()));
+ let affine = self
+ .common
+ .affine
+ .or_else(|| Some(cairo::Matrix::identity()));
+ let x = self.common.x.or_else(|| Some(Default::default()));
+ let y = self.common.y.or_else(|| Some(Default::default()));
+ let width = self.common.width.or_else(|| Some(Default::default()));
+ let height = self.common.height.or_else(|| Some(Default::default()));
let children = self.children.resolve_from_defaults();
UnresolvedPattern {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]