diff options
author | Jesse Luehrs <doy@tozt.net> | 2022-01-04 18:33:10 -0500 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2022-01-04 18:33:10 -0500 |
commit | 1a7c01f0494173d8e597eda2248c36835a1a3c08 (patch) | |
tree | 6b1edef823f705f867b1027696828306ad76b791 /src | |
parent | 8d71dab0c08ab613cf00601dea2af16bedc339f6 (diff) | |
download | nbsh-1a7c01f0494173d8e597eda2248c36835a1a3c08.tar.gz nbsh-1a7c01f0494173d8e597eda2248c36835a1a3c08.zip |
clean up env cloning a bit
Diffstat (limited to 'src')
-rw-r--r-- | src/state/history/mod.rs | 4 | ||||
-rw-r--r-- | src/state/mod.rs | 8 |
2 files changed, 6 insertions, 6 deletions
diff --git a/src/state/history/mod.rs b/src/state/history/mod.rs index 745caf7..ddcc75e 100644 --- a/src/state/history/mod.rs +++ b/src/state/history/mod.rs @@ -89,7 +89,7 @@ impl History { pub async fn run( &mut self, ast: crate::parse::Commands, - env: crate::env::Env, + env: &crate::env::Env, event_w: async_std::channel::Sender<crate::event::Event>, ) -> anyhow::Result<usize> { let (input_w, input_r) = async_std::channel::unbounded(); @@ -120,7 +120,7 @@ impl History { pub async fn parse_error( &mut self, e: crate::parse::Error, - env: crate::env::Env, + env: &crate::env::Env, event_w: async_std::channel::Sender<crate::event::Event>, ) -> anyhow::Result<usize> { // XXX would be great to not have to do this diff --git a/src/state/mod.rs b/src/state/mod.rs index 83d75c5..cb84698 100644 --- a/src/state/mod.rs +++ b/src/state/mod.rs @@ -225,7 +225,7 @@ impl State { Ok(ast) => { let idx = self .history - .run(ast, self.env.clone(), event_w.clone()) + .run(ast, &self.env, event_w.clone()) .await .unwrap(); self.set_focus(Focus::History(idx), Some(entry)) @@ -235,7 +235,7 @@ impl State { } Err(e) => self .history - .parse_error(e, self.env.clone(), event_w.clone()) + .parse_error(e, &self.env, event_w.clone()) .await .unwrap(), }; @@ -343,7 +343,7 @@ impl State { Ok(ast) => { let idx = self .history - .run(ast, self.env.clone(), event_w.clone()) + .run(ast, &self.env, event_w.clone()) .await .unwrap(); self.set_focus(Focus::History(idx), None).await; @@ -352,7 +352,7 @@ impl State { } Err(e) => self .history - .parse_error(e, self.env.clone(), event_w.clone()) + .parse_error(e, &self.env, event_w.clone()) .await .unwrap(), }; |