[librsvg] error.rs: Move an impl so all its related code is contiguous
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg] error.rs: Move an impl so all its related code is contiguous
- Date: Tue, 14 Jan 2020 00:37:20 +0000 (UTC)
commit 4d68feea649cc73aaf673329864aa8ed91d9c064
Author: Federico Mena Quintero <federico gnome org>
Date: Mon Jan 13 18:36:58 2020 -0600
error.rs: Move an impl so all its related code is contiguous
rsvg_internals/src/error.rs | 32 ++++++++++++++++----------------
1 file changed, 16 insertions(+), 16 deletions(-)
---
diff --git a/rsvg_internals/src/error.rs b/rsvg_internals/src/error.rs
index aee3f3d9..9a7c93cc 100644
--- a/rsvg_internals/src/error.rs
+++ b/rsvg_internals/src/error.rs
@@ -55,6 +55,22 @@ impl fmt::Display for ValueErrorKind {
}
}
+impl<'a> From<BasicParseError<'a>> for ValueErrorKind {
+ fn from(e: BasicParseError<'_>) -> ValueErrorKind {
+ let BasicParseError { kind, location: _ } = e;
+
+ let msg = match kind {
+ BasicParseErrorKind::UnexpectedToken(_) => "unexpected token",
+ BasicParseErrorKind::EndOfInput => "unexpected end of input",
+ BasicParseErrorKind::AtRuleInvalid(_) => "invalid @-rule",
+ BasicParseErrorKind::AtRuleBodyInvalid => "invalid @-rule body",
+ BasicParseErrorKind::QualifiedRuleInvalid => "invalid qualified rule",
+ };
+
+ ValueErrorKind::parse_error(msg)
+ }
+}
+
/// A complete error for an attribute and its erroneous value
#[derive(Debug, Clone, PartialEq)]
pub struct NodeError {
@@ -78,22 +94,6 @@ impl fmt::Display for NodeError {
}
}
-impl<'a> From<BasicParseError<'a>> for ValueErrorKind {
- fn from(e: BasicParseError<'_>) -> ValueErrorKind {
- let BasicParseError { kind, location: _ } = e;
-
- let msg = match kind {
- BasicParseErrorKind::UnexpectedToken(_) => "unexpected token",
- BasicParseErrorKind::EndOfInput => "unexpected end of input",
- BasicParseErrorKind::AtRuleInvalid(_) => "invalid @-rule",
- BasicParseErrorKind::AtRuleBodyInvalid => "invalid @-rule body",
- BasicParseErrorKind::QualifiedRuleInvalid => "invalid qualified rule",
- };
-
- ValueErrorKind::parse_error(msg)
- }
-}
-
#[derive(Debug, Clone, PartialEq)]
pub enum DefsLookupErrorKind {
HrefError(HrefError),
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]