diff --git a/src/converter.rs b/src/converter.rs index dc85849..05a5cb2 100644 --- a/src/converter.rs +++ b/src/converter.rs @@ -77,8 +77,8 @@ pub fn decimal_to_binary_lookup(dec: &BigUint) -> String { let trimmed: String = result.into_iter().rev().skip_while(|&c| c == '0').collect(); if trimmed.is_empty() { - "0".to_string() - } else { - trimmed + return "0".to_string(); } + + trimmed } diff --git a/src/main.rs b/src/main.rs index 8ae4e0d..0da763e 100644 --- a/src/main.rs +++ b/src/main.rs @@ -18,11 +18,7 @@ fn main() -> io::Result<()> { loop { //Menu options for the user - println!("\n1. Iterative method"); - println!("2. Recursive method"); - println!("3. Lookup table method (fastest method)"); - println!("4. Exit"); - print!("Choose a method (1-4): "); + print!("\n1. Iterative method\n2. Recursive method\n3. Lookup table method (fastest method)\n4. Exit\nChoose a method (1-4): "); io::stdout().flush()?;