[librsvg/marker: 9/9] marker: shorten parse function
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg/marker: 9/9] marker: shorten parse function
- Date: Sun, 5 Jan 2020 23:06:07 +0000 (UTC)
commit 893e7ae8b88bad823662d3f5b80b002136fdfaf0
Author: Paolo Borelli <pborelli gnome org>
Date: Sat Jan 4 12:59:13 2020 +0100
marker: shorten parse function
rsvg_internals/src/marker.rs | 11 +++--------
1 file changed, 3 insertions(+), 8 deletions(-)
---
diff --git a/rsvg_internals/src/marker.rs b/rsvg_internals/src/marker.rs
index a306f176..346dfb07 100644
--- a/rsvg_internals/src/marker.rs
+++ b/rsvg_internals/src/marker.rs
@@ -61,14 +61,9 @@ impl Default for MarkerOrient {
impl Parse for MarkerOrient {
fn parse<'i>(parser: &mut Parser<'i, '_>) -> Result<MarkerOrient, CssParseError<'i>> {
- if parser
- .try_parse(|p| p.expect_ident_matching("auto"))
- .is_ok()
- {
- Ok(MarkerOrient::Auto)
- } else {
- Angle::parse(parser).map(MarkerOrient::Angle)
- }
+ parser
+ .try_parse(|p| p.expect_ident_matching("auto").map(|_| MarkerOrient::Auto))
+ .or_else(|_| Angle::parse(parser).map(MarkerOrient::Angle))
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]