From 885f167afcd9d85cfa1d7d1ea2f51ff77a973467 Mon Sep 17 00:00:00 2001 From: emma Date: Fri, 2 Feb 2024 13:04:57 -0700 Subject: [PATCH] rpn(1): changes to error message --- src/rpn.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/rpn.rs b/src/rpn.rs index eede26b..10c4e20 100644 --- a/src/rpn.rs +++ b/src/rpn.rs @@ -129,18 +129,18 @@ fn eval( }; match x { - Val(x_) => stack.push_back(x_), + Val(v) => stack.push_back(v), _ => ops.push_back(x), } } for op in &ops { match op { - Val(_) => { - return Err(EvaluationError { - message: "Unexpected value in the operator stack." - .to_string() - }) + Val(v) => { + return Err(EvaluationError { message: format!( + "{}: Unexpected value in the operator stack.", + v + )}); }, _ => { let (x, y) = (