diff options
Diffstat (limited to 'src/lisp/number.rs')
-rw-r--r-- | src/lisp/number.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/lisp/number.rs b/src/lisp/number.rs index 18a41f7..23d7997 100644 --- a/src/lisp/number.rs +++ b/src/lisp/number.rs | |||
@@ -1,9 +1,9 @@ | |||
1 | use std::{ | 1 | use std::{ |
2 | fmt, | 2 | fmt, |
3 | ops::{Add, Div, Mul, Sub}, | 3 | ops::{Add, Mul, Sub}, |
4 | }; | 4 | }; |
5 | 5 | ||
6 | use crate::lisp::error::LispError; | 6 | use crate::lisp::error::{EvalError, LispError}; |
7 | 7 | ||
8 | #[derive(Debug, Copy, Clone)] | 8 | #[derive(Debug, Copy, Clone)] |
9 | pub enum LispNumber { | 9 | pub enum LispNumber { |
@@ -15,7 +15,7 @@ impl LispNumber { | |||
15 | pub fn div(self, rhs: Self) -> Result<LispNumber, LispError> { | 15 | pub fn div(self, rhs: Self) -> Result<LispNumber, LispError> { |
16 | use LispNumber::*; | 16 | use LispNumber::*; |
17 | if rhs == Integer(0) || rhs == Float(0.) { | 17 | if rhs == Integer(0) || rhs == Float(0.) { |
18 | return Err(LispError::EvalError); | 18 | return Err(EvalError::DivByZero.into()); |
19 | } else { | 19 | } else { |
20 | return Ok(match (self, rhs) { | 20 | return Ok(match (self, rhs) { |
21 | (Integer(a), Integer(b)) => Float(a as f64 / b as f64), | 21 | (Integer(a), Integer(b)) => Float(a as f64 / b as f64), |