From cf01169e467f4ac36d2d8b9ce13e7bbc81d46aa5 Mon Sep 17 00:00:00 2001 From: Mel Date: Sat, 2 Oct 2021 21:30:03 +0200 Subject: Immutable Fs implementation and replaced exists calls. --- src/actions/create.rs | 2 +- src/actions/shift.rs | 4 ++-- src/actions/update.rs | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) (limited to 'src/actions') diff --git a/src/actions/create.rs b/src/actions/create.rs index 20dbff7..c12d416 100644 --- a/src/actions/create.rs +++ b/src/actions/create.rs @@ -3,7 +3,7 @@ use anyhow::Result; use super::ActionOptions; -pub fn create(command_options: ActionOptions, fs: &mut impl Fs) -> Result<()> { +pub fn create(command_options: ActionOptions, fs: &impl Fs) -> Result<()> { let locations = Locations::from(&command_options); // FIXME: Re-add old repository deletion. // if locations.ka_path.exists() { diff --git a/src/actions/shift.rs b/src/actions/shift.rs index 8f37874..b9e62ac 100644 --- a/src/actions/shift.rs +++ b/src/actions/shift.rs @@ -10,7 +10,7 @@ use crate::{ use super::ActionOptions; -pub fn shift(command_options: ActionOptions, fs: &mut impl Fs, new_cursor: usize) -> Result<()> { +pub fn shift(command_options: ActionOptions, fs: &impl Fs, new_cursor: usize) -> Result<()> { let locations = Locations::from(&command_options); let repository_index_path = locations.get_repository_index_path(); @@ -38,7 +38,7 @@ pub fn shift(command_options: ActionOptions, fs: &mut impl Fs, new_cursor: usize acc }) .iter() - .map(|path| FileState::from_working(&locations, path)) + .map(|path| FileState::from_working(fs, &locations, path)) .collect(); for state in affected_files_by_shift? { diff --git a/src/actions/update.rs b/src/actions/update.rs index 8201862..421d5b0 100644 --- a/src/actions/update.rs +++ b/src/actions/update.rs @@ -11,7 +11,7 @@ use crate::{ use super::ActionOptions; -pub fn update(command_options: ActionOptions, fs: &mut impl Fs) -> Result<()> { +pub fn update(command_options: ActionOptions, fs: &impl Fs) -> Result<()> { let timestamp = SystemTime::now() .duration_since(SystemTime::UNIX_EPOCH)? .as_secs(); @@ -51,7 +51,7 @@ pub fn update(command_options: ActionOptions, fs: &mut impl Fs) -> Result<()> { } fn get_new_history_for_file( - fs: &mut FS, + fs: &FS, cursor: usize, file_state: &FileState, locations: &Locations, -- cgit 1.4.1