[librsvg: 10/11] Replace some "if Some(...)" with "?", per cargo-clippy
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg: 10/11] Replace some "if Some(...)" with "?", per cargo-clippy
- Date: Tue, 1 Dec 2020 18:24:44 +0000 (UTC)
commit 5d596ae6776d5c2a106b7591d4effcbb70848f99
Author: Federico Mena Quintero <federico gnome org>
Date: Tue Dec 1 12:01:15 2020 -0600
Replace some "if Some(...)" with "?", per cargo-clippy
src/gradient.rs | 6 +-----
src/pattern.rs | 11 ++++-------
2 files changed, 5 insertions(+), 12 deletions(-)
---
diff --git a/src/gradient.rs b/src/gradient.rs
index 96101878..1d9eb7d3 100644
--- a/src/gradient.rs
+++ b/src/gradient.rs
@@ -710,11 +710,7 @@ impl ResolvedGradient {
let params = draw_ctx.push_coord_units(units);
- let transform = if let Some(m) = transform.pre_transform(&self.transform).invert() {
- m
- } else {
- return None;
- };
+ let transform = transform.pre_transform(&self.transform).invert()?;
let variant = match self.variant {
ResolvedGradientVariant::Linear { x1, y1, x2, y2 } => GradientVariant::Linear {
diff --git a/src/pattern.rs b/src/pattern.rs
index fd7a5b0c..92680d08 100644
--- a/src/pattern.rs
+++ b/src/pattern.rs
@@ -315,7 +315,10 @@ impl UnresolvedChildren {
impl ResolvedPattern {
fn node_with_children(&self) -> Option<Node> {
match self.children {
+ // This means we didn't find any children among the fallbacks,
+ // so there is nothing to render.
Children::Empty => None,
+
Children::WithChildren(ref wc) => Some(wc.upgrade().unwrap()),
}
}
@@ -326,13 +329,7 @@ impl ResolvedPattern {
draw_ctx: &DrawingCtx,
values: &ComputedValues,
) -> Option<UserSpacePattern> {
- let node_with_children = if let Some(n) = self.node_with_children() {
- n
- } else {
- // This means we didn't find any children among the fallbacks,
- // so there is nothing to render.
- return None;
- };
+ let node_with_children = self.node_with_children()?;
let params = draw_ctx.push_coord_units(self.units.0);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]