summaryrefslogtreecommitdiff
path: root/src/compute
diff options
context:
space:
mode:
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");
}