[librsvg: 6/9] Minor cleanup: use .ok() instead of if-let
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg: 6/9] Minor cleanup: use .ok() instead of if-let
- Date: Wed, 26 May 2021 15:04:44 +0000 (UTC)
commit cb67d213199dee9996f382c99e9f568c4ae7dbd8
Author: John Ledbetter <john ledbetter gmail com>
Date: Mon May 24 09:37:21 2021 -0400
Minor cleanup: use .ok() instead of if-let
These two constructs are equivalent when converting a Result to an
Option, so let's use the shorter built-in.
src/filter_func.rs | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
---
diff --git a/src/filter_func.rs b/src/filter_func.rs
index c13d486a..a50484cc 100644
--- a/src/filter_func.rs
+++ b/src/filter_func.rs
@@ -123,11 +123,7 @@ where
// about that.
#[allow(clippy::unnecessary_wraps)]
fn parse_blur<'i>(parser: &mut Parser<'i, '_>) -> Result<FilterFunction, ParseError<'i>> {
- let length = if let Ok(length) = parser.try_parse(|p| Length::parse(p)) {
- Some(length)
- } else {
- None
- };
+ let length = parser.try_parse(|p| Length::parse(p)).ok();
Ok(FilterFunction::Blur(Blur {
std_deviation: length,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]