diff options
Diffstat (limited to 'tvix/eval/src/value/mod.rs')
-rw-r--r-- | tvix/eval/src/value/mod.rs | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/tvix/eval/src/value/mod.rs b/tvix/eval/src/value/mod.rs index 2ba9ce9b50e6..46021a167b27 100644 --- a/tvix/eval/src/value/mod.rs +++ b/tvix/eval/src/value/mod.rs @@ -33,11 +33,7 @@ pub enum Value { impl Value { pub fn is_number(&self) -> bool { - match self { - Value::Integer(_) => true, - Value::Float(_) => true, - _ => false, - } + matches!(self, Value::Integer(_) | Value::Float(_)) } pub fn type_of(&self) -> &'static str { @@ -66,7 +62,7 @@ impl Value { } } - pub fn as_string(self) -> EvalResult<NixString> { + pub fn to_string(self) -> EvalResult<NixString> { match self { Value::String(s) => Ok(s), other => Err(Error::TypeError { @@ -76,7 +72,7 @@ impl Value { } } - pub fn as_attrs(self) -> EvalResult<Rc<NixAttrs>> { + pub fn to_attrs(self) -> EvalResult<Rc<NixAttrs>> { match self { Value::Attrs(s) => Ok(s), other => Err(Error::TypeError { @@ -86,7 +82,7 @@ impl Value { } } - pub fn as_list(self) -> EvalResult<NixList> { + pub fn to_list(self) -> EvalResult<NixList> { match self { Value::List(l) => Ok(l), other => Err(Error::TypeError { |