[librsvg: 14/19] Avoid calling map(f) where f is a closure that returns the unit type
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg: 14/19] Avoid calling map(f) where f is a closure that returns the unit type
- Date: Fri, 21 Aug 2020 18:30:17 +0000 (UTC)
commit 4878c6eb7b362f8799bacbf63c8878904e2c0998
Author: Sven Neumann <sven svenfoo org>
Date: Fri Aug 21 12:12:11 2020 +0200
Avoid calling map(f) where f is a closure that returns the unit type
See https://rust-lang.github.io/rust-clippy/master/index.html#option_map_unit_fn
rsvg_internals/src/gradient.rs | 4 +++-
rsvg_internals/src/pattern.rs | 4 +++-
2 files changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/rsvg_internals/src/gradient.rs b/rsvg_internals/src/gradient.rs
index b133bf555..4118bff4c 100644
--- a/rsvg_internals/src/gradient.rs
+++ b/rsvg_internals/src/gradient.rs
@@ -776,7 +776,9 @@ impl Gradient {
) {
let transform = transform.pre_transform(&self.transform);
- transform.invert().map(|m| pattern.set_matrix(m.into()));
+ if let Some(m) = transform.invert() {
+ pattern.set_matrix(m.into())
+ }
pattern.set_extend(cairo::Extend::from(self.spread));
self.add_color_stops_to_pattern(pattern, opacity);
}
diff --git a/rsvg_internals/src/pattern.rs b/rsvg_internals/src/pattern.rs
index 4cb4cec59..0cc8ceacb 100644
--- a/rsvg_internals/src/pattern.rs
+++ b/rsvg_internals/src/pattern.rs
@@ -373,7 +373,9 @@ impl AsPaintSource for ResolvedPattern {
// Set the final surface as a Cairo pattern into the Cairo context
let pattern = cairo::SurfacePattern::create(&surface);
- affine.invert().map(|m| pattern.set_matrix(m.into()));
+ if let Some(m) = affine.invert() {
+ pattern.set_matrix(m.into())
+ }
pattern.set_extend(cairo::Extend::Repeat);
pattern.set_filter(cairo::Filter::Best);
cr_save.set_source(&pattern);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]