From 7b88057b3f382315c637a28558be9b4bf609f053 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christina=20S=C3=B8rensen?= Date: Tue, 17 Oct 2023 07:02:22 +0200 Subject: [PATCH] refactor(link): remove debug error messages MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Christina Sørensen --- src/git.rs | 54 ++++++++++++++++-------------------------------------- 1 file changed, 16 insertions(+), 38 deletions(-) diff --git a/src/git.rs b/src/git.rs index 55ed35b..ff87b7a 100644 --- a/src/git.rs +++ b/src/git.rs @@ -176,32 +176,19 @@ fn handle_file_exists(selff: &Link, tx_path: &Path, rx_path: &Path) -> Result { - debug!( - "Linking {} -> {} failed: file already linked", - &selff.tx, &selff.rx - ); Err(LinkError::AlreadyLinked( tx_path.to_string_lossy().to_string(), rx_path.to_string_lossy().to_string(), )) } - Ok(file) => { - error!( - "Linking {} -> {} failed: link to different file exists", - &selff.tx, &selff.rx - ); - Err(LinkError::DifferentLink( - tx_path.to_string_lossy().to_string(), - rx_path.to_string_lossy().to_string(), - )) - } - Err(error) => { - error!("Linking {} -> {} failed: file exists", &selff.tx, &selff.rx); - Err(LinkError::FileExists( - tx_path.to_string_lossy().to_string(), - rx_path.to_string_lossy().to_string(), - )) - } + Ok(file) => Err(LinkError::DifferentLink( + tx_path.to_string_lossy().to_string(), + rx_path.to_string_lossy().to_string(), + )), + Err(error) => Err(LinkError::FileExists( + tx_path.to_string_lossy().to_string(), + rx_path.to_string_lossy().to_string(), + )), } } @@ -213,27 +200,18 @@ impl Link { match rx_path.try_exists() { // TODO: unwrap defeats the purpose here. Ok(true) => handle_file_exists(self, tx_path, rx_path), - Ok(false) if rx_path.is_symlink() => { - error!( - "Linking {} -> {} failed: broken symlink", - &self.tx, &self.rx - ); - Err(LinkError::FileExists( - tx_path.to_string_lossy().to_string(), - rx_path.to_string_lossy().to_string(), - )) - } + Ok(false) if rx_path.is_symlink() => Err(LinkError::FileExists( + tx_path.to_string_lossy().to_string(), + rx_path.to_string_lossy().to_string(), + )), Ok(false) => { symlink(&self.tx, &self.rx)?; Ok(true) } - Err(error) => { - error!("Linking {} -> {} failed: {}", &self.tx, &self.rx, error); - Err(LinkError::FailedCreatingLink( - tx_path.to_string_lossy().to_string(), - rx_path.to_string_lossy().to_string(), - )) - } + Err(error) => Err(LinkError::FailedCreatingLink( + tx_path.to_string_lossy().to_string(), + rx_path.to_string_lossy().to_string(), + )), } } }