fix(lib): format and lint

This commit is contained in:
gbrochar 2024-01-15 13:44:19 +01:00
parent ed44fba94f
commit 56376fa2b8
2 changed files with 9 additions and 9 deletions

View File

@ -12,8 +12,8 @@ pub fn format(v: &[GaussianRational]) -> String {
let mut format; let mut format;
format = v[0].format(false); format = v[0].format(false);
if v.len() > 1 { if v.len() > 1 {
let mut format2 = v[1].format(true); let format2 = v[1].format(true);
if format2 == "" { if format2 != "" {
if format == "" { if format == "" {
format = format!("{}x", format2); format = format!("{}x", format2);
} else { } else {

View File

@ -13,7 +13,7 @@ fn degree_one(equation: Vec<GaussianRational>) {
println!("Polynomial degree: 1"); println!("Polynomial degree: 1");
let x = minus_one() * equation[0] / equation[1]; let x = minus_one() * equation[0] / equation[1];
println!("The solution is"); println!("The solution is");
let mut format = x.format(false); let mut format = crate::format(&[x]);
if format == "" { if format == "" {
format = String::from("0"); format = String::from("0");
} }