[librsvg] parse_fit_mode(): 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] parse_fit_mode(): This should be a standalone function, not a non-method
- Date: Fri, 21 Sep 2018 12:39:16 +0000 (UTC)
commit 2bea05a8950a2a8075eaa9c8a59c1df798c73514
Author: Federico Mena Quintero <federico gnome org>
Date: Fri Sep 14 11:57:12 2018 -0500
parse_fit_mode(): This should be a standalone function, not a non-method
rsvg_internals/src/aspect_ratio.rs | 14 ++++++--------
1 file changed, 6 insertions(+), 8 deletions(-)
---
diff --git a/rsvg_internals/src/aspect_ratio.rs b/rsvg_internals/src/aspect_ratio.rs
index 11d7ae4c..b02c2785 100644
--- a/rsvg_internals/src/aspect_ratio.rs
+++ b/rsvg_internals/src/aspect_ratio.rs
@@ -174,13 +174,11 @@ fn parse_align_xy(ident: &CowRcStr) -> Result<Option<(X, Y)>, ValueErrorKind> {
}
}
-impl FitMode {
- fn parse(s: &str) -> Result<FitMode, ValueErrorKind> {
- match s {
- "meet" => Ok(FitMode::Meet),
- "slice" => Ok(FitMode::Slice),
- _ => Err(ValueErrorKind::Parse(ParseError::new("invalid fit mode"))),
- }
+fn parse_fit_mode(s: &str) -> Result<FitMode, ValueErrorKind> {
+ match s {
+ "meet" => Ok(FitMode::Meet),
+ "slice" => Ok(FitMode::Slice),
+ _ => Err(ValueErrorKind::Parse(ParseError::new("invalid fit mode"))),
}
}
@@ -201,7 +199,7 @@ impl Parse for AspectRatio {
.try(|p| {
p.expect_ident()
.map_err(|_| ValueErrorKind::Parse(ParseError::new("expected identifier")))
- .and_then(|ident| FitMode::parse(ident))
+ .and_then(|ident| parse_fit_mode(ident))
}).unwrap_or(FitMode::default());
parser
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]