clippy
This commit is contained in:
parent
d63af25774
commit
9b46d9d79e
@ -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.
|
// 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 {
|
pub fn test_func(function_string: String) -> String {
|
||||||
// Factorials do not work, and it would be really difficult to make them work
|
// 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();
|
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_result = new_func_str.parse();
|
||||||
let expr_error = match &expr_result {
|
let expr_error = match &expr_result {
|
||||||
Ok(_) => "".to_string(),
|
Ok(_) => "".to_string(),
|
||||||
|
|||||||
@ -72,10 +72,8 @@ pub fn add_asterisks(function_in: String) -> String {
|
|||||||
{
|
{
|
||||||
add_asterisk = true;
|
add_asterisk = true;
|
||||||
}
|
}
|
||||||
} else if numbers.contains(&c) {
|
} else if numbers.contains(&c) && letters.contains(&prev_char) | prev_pi {
|
||||||
if letters.contains(&prev_char) | prev_pi {
|
add_asterisk = true;
|
||||||
add_asterisk = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if add_asterisk {
|
if add_asterisk {
|
||||||
@ -86,7 +84,7 @@ pub fn add_asterisks(function_in: String) -> String {
|
|||||||
output_string += &c.to_string();
|
output_string += &c.to_string();
|
||||||
}
|
}
|
||||||
|
|
||||||
return output_string;
|
output_string
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Result of screen to chart coordinates conversion.
|
/// Result of screen to chart coordinates conversion.
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user