summaryrefslogtreecommitdiff
path: root/src/compute
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2020-10-01 11:32:48 +0200
committerLaurenz <laurmaedje@gmail.com>2020-10-01 11:32:48 +0200
commit885bfec5d7524845b41e180fadc9cf5626157eec (patch)
treef798e03d101d568a110a5c56f4a9bfa2be892928 /src/compute
parent16f0bd430e0864a3bbd0139803e476be413cb3cb (diff)
Make syntax not depend on parse 📩
This would make it possible to split them into two separate crates.
Diffstat (limited to 'src/compute')
-rw-r--r--src/compute/value.rs16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/compute/value.rs b/src/compute/value.rs
index ef36e5d8..e8e4cbe1 100644
--- a/src/compute/value.rs
+++ b/src/compute/value.rs
@@ -310,7 +310,7 @@ macro_rules! impl_ident {
impl TryFromValue for $type {
fn try_from_value(value: Spanned<&Value>, f: &mut Feedback) -> Option<Self> {
if let Value::Ident(ident) = value.v {
- let val = $parse(ident.as_str());
+ let val = $parse(ident);
if val.is_none() {
error!(@f, value.span, "invalid {}", $name);
}
@@ -352,6 +352,12 @@ impl_match!(ScaleLength, "number or length",
/// `Into<String>`.
pub struct StringLike(pub String);
+impl From<StringLike> for String {
+ fn from(like: StringLike) -> String {
+ like.0
+ }
+}
+
impl Deref for StringLike {
type Target = str;
@@ -360,12 +366,6 @@ impl Deref for StringLike {
}
}
-impl From<StringLike> for String {
- fn from(like: StringLike) -> String {
- like.0
- }
-}
-
impl_match!(StringLike, "identifier or string",
Value::Ident(Ident(s)) => StringLike(s.clone()),
Value::Str(s) => StringLike(s.clone()),
@@ -410,7 +410,7 @@ impl TryFromValue for FontWeight {
}
}
Value::Ident(ident) => {
- let weight = Self::from_str(ident.as_str());
+ let weight = Self::from_str(ident);
if weight.is_none() {
error!(@f, value.span, "invalid font weight");
}