aboutsummaryrefslogtreecommitdiff
path: root/src/error/mod.rs
diff options
context:
space:
mode:
authorIvan Tham <[email protected]>2019-08-03 08:22:01 +0100
committerIvan Tham <[email protected]>2019-08-03 08:22:01 +0100
commitae36284d60b828869ede5a77343ccb307046b69a (patch)
tree6096e09a01b472e3415bf8a0401f198644a1089d /src/error/mod.rs
parent3b630aa5cf2fd58b10bb8a24c9818fda1d5049af (diff)
Fix clippy lints
Diffstat (limited to 'src/error/mod.rs')
-rw-r--r--src/error/mod.rs20
1 files changed, 7 insertions, 13 deletions
diff --git a/src/error/mod.rs b/src/error/mod.rs
index 9ac6816..ec2b555 100644
--- a/src/error/mod.rs
+++ b/src/error/mod.rs
@@ -13,23 +13,17 @@ pub enum CalcError {
13pub enum Math { 13pub enum Math {
14 DivideByZero, 14 DivideByZero,
15 OutOfBounds, 15 OutOfBounds,
16 UnknownBase 16 UnknownBase,
17} 17}
18 18
19pub fn handler(e: CalcError) -> String { 19pub fn handler(e: CalcError) -> String {
20 match e { 20 match e {
21 CalcError::Math(math_err) => { 21 CalcError::Math(math_err) => match math_err {
22 match math_err { 22 Math::DivideByZero => "Math Error: Divide by zero error!".to_string(),
23 Math::DivideByZero => format!("Math Error: Divide by zero error!"), 23 Math::OutOfBounds => "Domain Error: Out of bounds!".to_string(),
24 Math::OutOfBounds => format!("Domain Error: Out of bounds!"), 24 Math::UnknownBase => "Base too large! Accepted ranges: 0 - 36".to_string(),
25 Math::UnknownBase => format!("Base too large! Accepted ranges: 0 - 36")
26 }
27 }, 25 },
28 CalcError::Syntax(details) => { 26 CalcError::Syntax(details) => format!("Syntax Error: {}", details),
29 format!("Syntax Error: {}", details) 27 CalcError::Parser(details) => format!("Parser Error: {}", details),
30 },
31 CalcError::Parser(details) => {
32 format!("Parser Error: {}", details)
33 }
34 } 28 }
35} 29}