From 9b46d9d79e2e835dc4964e73c7241b9ab30aeac0 Mon Sep 17 00:00:00 2001 From: Simon Gardling Date: Thu, 17 Feb 2022 14:42:10 -0500 Subject: [PATCH] clippy --- src/lib.rs | 4 ++-- src/misc.rs | 8 +++----- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 628b202..0e571c1 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -66,11 +66,11 @@ impl ChartManager { // Tests function to make sure it's able to be parsed. Returns the string of the Error produced, or an empty string if it runs successfully. pub fn test_func(function_string: String) -> String { // Factorials do not work, and it would be really difficult to make them work - if function_string.contains("!") { + if function_string.contains('!') { return "Factorials are unsupported".to_string(); } - let new_func_str: String = add_asterisks(function_string.clone()); + let new_func_str: String = add_asterisks(function_string); let expr_result = new_func_str.parse(); let expr_error = match &expr_result { Ok(_) => "".to_string(), diff --git a/src/misc.rs b/src/misc.rs index efd2e2d..db3b227 100644 --- a/src/misc.rs +++ b/src/misc.rs @@ -72,10 +72,8 @@ pub fn add_asterisks(function_in: String) -> String { { add_asterisk = true; } - } else if numbers.contains(&c) { - if letters.contains(&prev_char) | prev_pi { - add_asterisk = true; - } + } else if numbers.contains(&c) && letters.contains(&prev_char) | prev_pi { + add_asterisk = true; } if add_asterisk { @@ -86,7 +84,7 @@ pub fn add_asterisks(function_in: String) -> String { output_string += &c.to_string(); } - return output_string; + output_string } /// Result of screen to chart coordinates conversion.