Avoiding a clone when loading the program from file

master
Wynd 2024-10-20 14:26:25 +03:00
parent b416a32ee7
commit 4b29043d58
1 changed files with 2 additions and 2 deletions

View File

@ -98,9 +98,9 @@ fn input() -> Vec<u8> {
fn load_program() -> Vec<u8> { fn load_program() -> Vec<u8> {
let args: Vec<String> = env::args().collect(); let args: Vec<String> = env::args().collect();
let input = args[1].clone(); let input = args.get(1).expect("malformed arguments");
let path: PathBuf = input.into(); let path: PathBuf = input.into();
let input = fs::read_to_string(path).unwrap(); let input = fs::read_to_string(path).expect("failed to read the program file");
input.as_bytes().to_vec() input.as_bytes().to_vec()
} }