From 05ce0f6e2d4a7002e4f82c403fa80f1e2ccab603 Mon Sep 17 00:00:00 2001 From: Raatty Date: Tue, 4 Dec 2018 23:21:58 +1300 Subject: [PATCH] changed evals unwraps to unwrap_or to stop the lack of numbers panicing --- src/main.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main.rs b/src/main.rs index 8c48057..167dde8 100644 --- a/src/main.rs +++ b/src/main.rs @@ -27,8 +27,8 @@ impl Calc { self.display(); } fn eval(&mut self) { - let left = self.left.parse::().unwrap(); - let right = self.right.parse::().unwrap(); + let left = self.left.parse::().unwrap_or(0); + let right = self.right.parse::().unwrap_or(0); let ans = match self.operator { Some(Operators::PLUS) => left + right, Some(Operators::MINUS) => left - right,