[librsvg/librsvg-2.44] parse_align_xy(): This should be a standalone function, not a non-method
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg/librsvg-2.44] parse_align_xy(): This should be a standalone function, not a non-method
- Date: Fri, 21 Sep 2018 17:39:36 +0000 (UTC)
commit 4666c226c066ad099c8bdf020db286b35691f0cc
Author: Federico Mena Quintero <federico gnome org>
Date: Fri Sep 14 11:55:25 2018 -0500
parse_align_xy(): This should be a standalone function, not a non-method
rsvg_internals/src/aspect_ratio.rs | 32 +++++++++++++++-----------------
1 file changed, 15 insertions(+), 17 deletions(-)
---
diff --git a/rsvg_internals/src/aspect_ratio.rs b/rsvg_internals/src/aspect_ratio.rs
index 9c48951b..11d7ae4c 100644
--- a/rsvg_internals/src/aspect_ratio.rs
+++ b/rsvg_internals/src/aspect_ratio.rs
@@ -152,27 +152,25 @@ impl AspectRatio {
}
}
-impl Align {
- fn parse_xy(ident: &CowRcStr) -> Result<Option<(X, Y)>, ValueErrorKind> {
- use self::Align1D::*;
+fn parse_align_xy(ident: &CowRcStr) -> Result<Option<(X, Y)>, ValueErrorKind> {
+ use self::Align1D::*;
- match ident.as_ref() {
- "none" => Ok(None),
+ match ident.as_ref() {
+ "none" => Ok(None),
- "xMinYMin" => Ok(Some((X(Min), Y(Min)))),
- "xMidYMin" => Ok(Some((X(Mid), Y(Min)))),
- "xMaxYMin" => Ok(Some((X(Max), Y(Min)))),
+ "xMinYMin" => Ok(Some((X(Min), Y(Min)))),
+ "xMidYMin" => Ok(Some((X(Mid), Y(Min)))),
+ "xMaxYMin" => Ok(Some((X(Max), Y(Min)))),
- "xMinYMid" => Ok(Some((X(Min), Y(Mid)))),
- "xMidYMid" => Ok(Some((X(Mid), Y(Mid)))),
- "xMaxYMid" => Ok(Some((X(Max), Y(Mid)))),
+ "xMinYMid" => Ok(Some((X(Min), Y(Mid)))),
+ "xMidYMid" => Ok(Some((X(Mid), Y(Mid)))),
+ "xMaxYMid" => Ok(Some((X(Max), Y(Mid)))),
- "xMinYMax" => Ok(Some((X(Min), Y(Max)))),
- "xMidYMax" => Ok(Some((X(Mid), Y(Max)))),
- "xMaxYMax" => Ok(Some((X(Max), Y(Max)))),
+ "xMinYMax" => Ok(Some((X(Min), Y(Max)))),
+ "xMidYMax" => Ok(Some((X(Mid), Y(Max)))),
+ "xMaxYMax" => Ok(Some((X(Max), Y(Max)))),
- _ => Err(ValueErrorKind::Parse(ParseError::new("invalid alignment"))),
- }
+ _ => Err(ValueErrorKind::Parse(ParseError::new("invalid alignment"))),
}
}
@@ -196,7 +194,7 @@ impl Parse for AspectRatio {
let align_xy = parser.try(|p| {
p.expect_ident()
.map_err(|_| ValueErrorKind::Parse(ParseError::new("expected identifier")))
- .and_then(|ident| Align::parse_xy(ident))
+ .and_then(|ident| parse_align_xy(ident))
})?;
let fit = parser
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]