Browse Source

refactoring: deleted unnecessary variable declaration, spacing

main
fdai7374 2 years ago
parent
commit
f4ade2d4e7
  1. 11
      src/builtins/help.rs

11
src/builtins/help.rs

@ -20,17 +20,16 @@ impl Builtin for Help {
"; ";
for line in commands.lines() { for line in commands.lines() {
println!("{}{}", split_command(line)[0].bold(),split_command(line)[1]);
println!("{}{}", split_command(line)[0].bold(), split_command(line)[1]);
} }
Ok(()) Ok(())
} }
} }
fn split_command(commands: &str) -> Vec<&str> { fn split_command(commands: &str) -> Vec<&str> {
let mut splitted_command: Vec<&str> = vec![];
if !commands.is_empty() && commands.trim().len() >=1 {
splitted_command = commands.trim_start().splitn(2, " ").collect();
return splitted_command
if !commands.is_empty() && commands.trim().len() >= 1 {
let splitted_command = commands.trim_start().splitn(2, " ").collect();
return splitted_command;
} }
return vec!["",""];
return vec!["", ""];
} }
Loading…
Cancel
Save