[librsvg/librsvg-2.52: 17/19] Appease clippy
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg/librsvg-2.52: 17/19] Appease clippy
- Date: Thu, 17 Feb 2022 03:49:56 +0000 (UTC)
commit 9e82373a9c86b85de285d2ae9f0413b1adbd77f2
Author: Federico Mena Quintero <federico gnome org>
Date: Wed Feb 16 21:09:08 2022 -0600
Appease clippy
src/aspect_ratio.rs | 4 ++--
src/filter.rs | 8 +-------
src/filter_func.rs | 4 ++--
src/gradient.rs | 7 +------
src/paint_server.rs | 2 +-
5 files changed, 7 insertions(+), 18 deletions(-)
---
diff --git a/src/aspect_ratio.rs b/src/aspect_ratio.rs
index c9e8a36e8..8003f9f2e 100644
--- a/src/aspect_ratio.rs
+++ b/src/aspect_ratio.rs
@@ -231,8 +231,8 @@ impl Parse for AspectRatio {
.try_parse(|p| p.expect_ident_matching("defer"))
.is_ok();
- let align_xy = parser.try_parse(|p| parse_align_xy(p))?;
- let fit = parser.try_parse(|p| parse_fit_mode(p)).unwrap_or_default();
+ let align_xy = parser.try_parse(parse_align_xy)?;
+ let fit = parser.try_parse(parse_fit_mode).unwrap_or_default();
let align = align_xy.map(|(x, y)| Align { x, y, fit });
Ok(AspectRatio { defer, align })
diff --git a/src/filter.rs b/src/filter.rs
index 660beb41e..98552aea8 100644
--- a/src/filter.rs
+++ b/src/filter.rs
@@ -166,15 +166,9 @@ fn filter_spec_from_filter_node(
})
}
-#[derive(Debug, Clone, PartialEq)]
+#[derive(Debug, Default, Clone, PartialEq)]
pub struct FilterValueList(Vec<FilterValue>);
-impl Default for FilterValueList {
- fn default() -> FilterValueList {
- FilterValueList(vec![])
- }
-}
-
impl FilterValueList {
pub fn is_empty(&self) -> bool {
self.0.is_empty()
diff --git a/src/filter_func.rs b/src/filter_func.rs
index ece4e9f2b..f7f93c40a 100644
--- a/src/filter_func.rs
+++ b/src/filter_func.rs
@@ -192,7 +192,7 @@ fn parse_dropshadow<'i>(parser: &mut Parser<'i, '_>) -> Result<FilterFunction, P
std_deviation: None,
};
- result.color = parser.try_parse(|p| Color::parse(p)).ok();
+ result.color = parser.try_parse(Color::parse).ok();
// if dx is provided, dy must follow and an optional std_dev must follow that.
if let Ok(dx) = parser.try_parse(|p| Length::parse(p)) {
@@ -206,7 +206,7 @@ fn parse_dropshadow<'i>(parser: &mut Parser<'i, '_>) -> Result<FilterFunction, P
// because the color and length arguments can be provided in either order,
// check again after potentially parsing lengths if the color is now provided.
// if a color is provided both before and after, that is an error.
- if let Ok(c) = parser.try_parse(|p| Color::parse(p)) {
+ if let Ok(c) = parser.try_parse(Color::parse) {
if result.color.is_some() {
return Err(
loc.new_custom_error(ValueErrorKind::Value("color already specified".to_string()))
diff --git a/src/gradient.rs b/src/gradient.rs
index d2a35e888..abe374e19 100644
--- a/src/gradient.rs
+++ b/src/gradient.rs
@@ -689,12 +689,7 @@ impl ResolvedGradient {
values: &ComputedValues,
) -> Option<UserSpaceGradient> {
let units = self.units.0;
- let transform = if let Ok(t) = bbox.rect_to_transform(units) {
- t
- } else {
- return None;
- };
-
+ let transform = bbox.rect_to_transform(units).ok()?;
let view_params = current_params.with_units(units);
let params = NormalizeParams::new(values, &view_params);
diff --git a/src/paint_server.rs b/src/paint_server.rs
index e4c75f15a..a744c7286 100644
--- a/src/paint_server.rs
+++ b/src/paint_server.rs
@@ -92,7 +92,7 @@ impl Parse for PaintServer {
{
None
} else {
- Some(parser.try_parse(|i| cssparser::Color::parse(i))?)
+ Some(parser.try_parse(cssparser::Color::parse)?)
}
} else {
None
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]