From be614537307d95b461b05984a870df08395c0d10 Mon Sep 17 00:00:00 2001 From: fdai7374 Date: Wed, 1 Feb 2023 19:47:08 +0100 Subject: [PATCH] refactoring: deleted unnecessary variable declaration, spacing --- src/builtins/help.rs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/builtins/help.rs b/src/builtins/help.rs index d75df35..4066e5f 100644 --- a/src/builtins/help.rs +++ b/src/builtins/help.rs @@ -20,17 +20,16 @@ impl Builtin for Help { "; 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(()) } } 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!["", ""]; } \ No newline at end of file