From ae36284d60b828869ede5a77343ccb307046b69a Mon Sep 17 00:00:00 2001 From: Ivan Tham Date: Sat, 3 Aug 2019 15:22:01 +0800 Subject: Fix clippy lints --- src/error/mod.rs | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) (limited to 'src/error') 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 { pub enum Math { DivideByZero, OutOfBounds, - UnknownBase + UnknownBase, } pub fn handler(e: CalcError) -> String { match e { - CalcError::Math(math_err) => { - match math_err { - Math::DivideByZero => format!("Math Error: Divide by zero error!"), - Math::OutOfBounds => format!("Domain Error: Out of bounds!"), - Math::UnknownBase => format!("Base too large! Accepted ranges: 0 - 36") - } + CalcError::Math(math_err) => match math_err { + Math::DivideByZero => "Math Error: Divide by zero error!".to_string(), + Math::OutOfBounds => "Domain Error: Out of bounds!".to_string(), + Math::UnknownBase => "Base too large! Accepted ranges: 0 - 36".to_string(), }, - CalcError::Syntax(details) => { - format!("Syntax Error: {}", details) - }, - CalcError::Parser(details) => { - format!("Parser Error: {}", details) - } + CalcError::Syntax(details) => format!("Syntax Error: {}", details), + CalcError::Parser(details) => format!("Parser Error: {}", details), } } -- cgit v1.2.3