diff --git a/src/lib.rs b/src/lib.rs index 1eb62e2..ebb9bbe 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -24,17 +24,11 @@ pub fn reply(message: &str) -> &str { if u > l { shouted = true; } if u+l+n == 0 { silence = true; } - if shouted { - if question { - return "Calm down, I know what I'm doing!" - } else { - return "Whoa, chill out!" - } - } else if question { - return "Sure." - } else if silence { - return "Fine. Be that way!" - } else { - return "Whatever." + match (question,shouted, silence) { + (true,true, _ ) => "Calm down, I know what I'm doing!", + (true, _ , _ ) => "Sure.", + ( _ ,true, _ ) => "Whoa, chill out!", + ( _ , _ ,true) => "Fine. Be that way!", + ( _ , _ , _ ) => "Whatever.", } }