fix: formatting

This commit is contained in:
Jonathan Kelley committed 2022-01-07 11:27:58 -05:00
1 parent 47056fda45
commit b49928a4ac
1 file changed
+9 -26
+9 -26
View File
@@ -144,7 +144,6 @@ fn app(cx: Scope) -> Element {
} }
fn calc_val(val: String) -> f64 { fn calc_val(val: String) -> f64 {
let mut result; let mut result;
let mut temp = String::new(); let mut temp = String::new();
let mut operation = "+".to_string(); let mut operation = "+".to_string();
@@ -152,7 +151,7 @@ fn calc_val(val: String) -> f64 {
let mut start_index = 0; let mut start_index = 0;
let mut temp_value; let mut temp_value;
let mut fin_index = 0; let mut fin_index = 0;
if &val[0..1] == "-" { if &val[0..1] == "-" {
temp_value = String::from("-"); temp_value = String::from("-");
fin_index = 1; fin_index = 1;
@@ -178,18 +177,10 @@ fn calc_val(val: String) -> f64 {
if c == '+' || c == '-' || c == '*' || c == '/' { if c == '+' || c == '-' || c == '*' || c == '/' {
if temp != "" { if temp != "" {
match &operation as &str { match &operation as &str {
"+" => { "+" => result += temp.parse::<f64>().unwrap(),
result += temp.parse::<f64>().unwrap(); "-" => result -= temp.parse::<f64>().unwrap(),
} "*" => result *= temp.parse::<f64>().unwrap(),
"-" => { "/" => result /= temp.parse::<f64>().unwrap(),
result -= temp.parse::<f64>().unwrap();
}
"*" => {
result *= temp.parse::<f64>().unwrap();
}
"/" => {
result /= temp.parse::<f64>().unwrap();
}
_ => unreachable!(), _ => unreachable!(),
}; };
} }
@@ -202,18 +193,10 @@ fn calc_val(val: String) -> f64 {
if temp != "" { if temp != "" {
match &operation as &str { match &operation as &str {
"+" => { "+" => result += temp.parse::<f64>().unwrap(),
result += temp.parse::<f64>().unwrap(); "-" => result -= temp.parse::<f64>().unwrap(),
} "*" => result *= temp.parse::<f64>().unwrap(),
"-" => { "/" => result /= temp.parse::<f64>().unwrap(),
result -= temp.parse::<f64>().unwrap();
}
"*" => {
result *= temp.parse::<f64>().unwrap();
}
"/" => {
result /= temp.parse::<f64>().unwrap();
}
_ => unreachable!(), _ => unreachable!(),
}; };
} }