[librsvg: 1/45] Use or_else() to compute fallbacks in gradients/patterns
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg: 1/45] Use or_else() to compute fallbacks in gradients/patterns
- Date: Tue, 1 Oct 2019 15:07:01 +0000 (UTC)
commit 1d73b9f62ee263c2c0899221fcd66d0d78f2bf32
Author: Federico Mena Quintero <federico gnome org>
Date: Thu Sep 26 16:59:04 2019 -0500
Use or_else() to compute fallbacks in gradients/patterns
Saves a little computation, or maybe some allocations in the case of
gradient stops, if the destination gradient/pattern already has a field set.
rsvg_internals/src/gradient.rs | 2 +-
rsvg_internals/src/pattern.rs | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/rsvg_internals/src/gradient.rs b/rsvg_internals/src/gradient.rs
index 45bcde3b..3f4ffb69 100644
--- a/rsvg_internals/src/gradient.rs
+++ b/rsvg_internals/src/gradient.rs
@@ -75,7 +75,7 @@ impl From<SpreadMethod> for cairo::Extend {
macro_rules! fallback_to (
($dest:expr, $default:expr) => (
- $dest = $dest.take ().or ($default)
+ $dest = $dest.take ().or_else (|| $default)
);
);
diff --git a/rsvg_internals/src/pattern.rs b/rsvg_internals/src/pattern.rs
index 291d81d3..90977205 100644
--- a/rsvg_internals/src/pattern.rs
+++ b/rsvg_internals/src/pattern.rs
@@ -25,7 +25,7 @@ coord_units!(PatternContentUnits, CoordUnits::UserSpaceOnUse);
macro_rules! fallback_to (
($dest:expr, $default:expr) => (
- $dest = $dest.take ().or ($default)
+ $dest = $dest.take ().or_else (|| $default)
);
);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]