parser : String::default -> String::new

This commit is contained in:
Ahurac 2024-04-15 16:54:09 +02:00
parent 1e4f8cadd6
commit 5df428a364

View file

@ -2,7 +2,7 @@ use crate::command::command_builder::CommandBuilder;
use crate::command::command_sequence::CommandSequence;
fn parse_quote(characters: &mut Vec<char>) -> String {
let mut quoted = String::default();
let mut quoted = String::new();
if !characters.is_empty() {
let mut current_char = characters.pop().unwrap();
@ -35,7 +35,7 @@ fn parse_main(characters: &mut Vec<char>, current_arg: &mut String) -> Vec<Strin
if current_char.is_whitespace() {
if !current_arg.is_empty() {
let mut argv: Vec<String> = vec![current_arg.clone()];
argv.append(&mut parse_main(characters, &mut String::default()));
argv.append(&mut parse_main(characters, &mut String::new()));
argv
} else {
@ -72,7 +72,7 @@ pub fn parse(line: String) -> CommandSequence {
let mut command_sequence = CommandSequence::new();
while !characters.is_empty() {
let argv = parse_main(&mut characters, &mut String::default());
let argv = parse_main(&mut characters, &mut String::new());
if !argv.is_empty() {
let command = CommandBuilder::new(argv).build();