summaryrefslogtreecommitdiffstats
path: root/src/commands/touch_file.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/commands/touch_file.rs')
-rw-r--r--src/commands/touch_file.rs16
1 files changed, 7 insertions, 9 deletions
diff --git a/src/commands/touch_file.rs b/src/commands/touch_file.rs
index 41ba1c3..5fbf039 100644
--- a/src/commands/touch_file.rs
+++ b/src/commands/touch_file.rs
@@ -48,16 +48,14 @@ pub fn touch_file(context: &mut AppContext, arg: &str) -> AppResult {
.map(|lst| lst.file_path().to_path_buf());
if let Some(path) = path {
- let config = context.config_ref().clone();
- let options = context.config_ref().display_options_ref().clone();
- let tab_options = context
- .tab_context_ref()
- .curr_tab_ref()
- .option_ref()
- .clone();
+ let new_dirlist = {
+ let options = context.config_ref().display_options_ref();
+ let tab_options = context.tab_context_ref().curr_tab_ref().option_ref();
+ let history = context.tab_context_ref().curr_tab_ref().history_ref();
+
+ create_dirlist_with_history(history, path.as_path(), options, tab_options)?
+ };
let history = context.tab_context_mut().curr_tab_mut().history_mut();
- let new_dirlist =
- create_dirlist_with_history(history, path.as_path(), &config, &options, &tab_options)?;
history.insert(path, new_dirlist);
}