fix: formatting
This commit is contained in:
1 parent
47056fda45
commit
b49928a4ac
1 file changed
+8
-25
+8
-25
@@ -144,7 +144,6 @@ fn app(cx: Scope) -> Element {
|
||||
}
|
||||
|
||||
fn calc_val(val: String) -> f64 {
|
||||
|
||||
let mut result;
|
||||
let mut temp = String::new();
|
||||
let mut operation = "+".to_string();
|
||||
@@ -178,18 +177,10 @@ fn calc_val(val: String) -> f64 {
|
||||
if c == '+' || c == '-' || c == '*' || c == '/' {
|
||||
if temp != "" {
|
||||
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!(),
|
||||
};
|
||||
}
|
||||
@@ -202,18 +193,10 @@ fn calc_val(val: String) -> f64 {
|
||||
|
||||
if temp != "" {
|
||||
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!(),
|
||||
};
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user