From 748bd10dd94eb5e4c360a3e14f9d2b5af698695c Mon Sep 17 00:00:00 2001 From: Daniel M Date: Fri, 11 Feb 2022 16:05:05 +0100 Subject: [PATCH] Fix runtime error msg --- src/interpreter.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/interpreter.rs b/src/interpreter.rs index 2477dfb..2b8bf7d 100644 --- a/src/interpreter.rs +++ b/src/interpreter.rs @@ -12,7 +12,7 @@ use crate::{ #[derive(Debug, Error)] pub enum RuntimeError { - #[error("Invalid array Index: {}", 0.to_string())] + #[error("Invalid array Index: {0:?}")] InvalidArrayIndex(Value), #[error("Variable used but not declared: {0}")] @@ -21,10 +21,10 @@ pub enum RuntimeError { #[error("Can't index into non-array variable: {0}")] TryingToIndexNonArray(String), - #[error("Invalid value type for unary operation: {}", 0.to_string())] + #[error("Invalid value type for unary operation: {0:?}")] UnOpInvalidType(Value), - #[error("Incompatible binary operations. Operands don't match: {} {}", 0.to_string(), 1.to_string())] + #[error("Incompatible binary operations. Operands don't match: {0:?} and {1:?}")] BinOpIncompatibleTypes(Value, Value), #[error("Array access out of bounds: Accessed {0}, size is {1}")]