From 87c7f0cefb67ab171ed0d5dda401267f1bb4b231 Mon Sep 17 00:00:00 2001 From: Raatty Date: Wed, 5 Dec 2018 22:22:39 +1300 Subject: [PATCH] a negative answer no longer crashes the program --- src/main.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main.rs b/src/main.rs index 167dde8..66152d8 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_or(0); - let right = self.right.parse::().unwrap_or(0); + 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,