From ae132f478c6cfc6ffb062fecd7efb42ac4e5d804 Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Mon, 3 Jan 2022 06:36:44 -0500 Subject: stop cloning exe and env all over the place --- src/parse.rs | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'src/parse.rs') diff --git a/src/parse.rs b/src/parse.rs index 0249d7f..4bdbce2 100644 --- a/src/parse.rs +++ b/src/parse.rs @@ -51,11 +51,8 @@ impl Exe { self.args.iter().map(|arg| arg.word.as_ref()) } - pub fn shift(&self) -> Self { - let mut new = self.clone(); - let new_exe = new.args.remove(0); - new.exe = new_exe; - new + pub fn shift(&mut self) { + self.exe = self.args.remove(0); } } @@ -75,8 +72,8 @@ impl Pipeline { )) } - pub fn exes(&self) -> &[Exe] { - &self.exes + pub fn into_exes(self) -> impl Iterator { + self.exes.into_iter() } pub fn input_string(&self) -> &str { -- cgit v1.2.3-54-g00ecf