From a13069f0184504f6ba13720127940fd488deeb3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jelmer=20Vernoo=C4=B3?= Date: Sun, 17 Nov 2024 08:27:03 +0000 Subject: [PATCH 1/2] Remove unused import --- Cargo.lock | 2 +- src/ed.rs | 4 ++-- src/unified.rs | 1 - 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 91e9dce..638b0ff 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -169,7 +169,7 @@ checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" [[package]] name = "patchkit" -version = "0.2.0" +version = "0.2.1" dependencies = [ "chrono", "lazy-regex", diff --git a/src/ed.rs b/src/ed.rs index 7038471..0ace722 100644 --- a/src/ed.rs +++ b/src/ed.rs @@ -12,7 +12,7 @@ impl crate::ContentPatch for EdPatch { let lines = splitlines(orig).collect::>(); let result = self .apply(&lines) - .map_err(|e| crate::ApplyError::Conflict(e))?; + .map_err(crate::ApplyError::Conflict)?; Ok(result) } } @@ -27,7 +27,7 @@ impl EdPatch { assert_eq!(start, end); let existing = match data.get(start - 1) { Some(existing) => existing, - None => return Err(format!("line {} does not exist", start).into()), + None => return Err(format!("line {} does not exist", start)), }; if existing != expected { return Err(format!( diff --git a/src/unified.rs b/src/unified.rs index a83ed36..b32e8a1 100644 --- a/src/unified.rs +++ b/src/unified.rs @@ -1,6 +1,5 @@ //! Parsing of unified patches use crate::{ContentPatch, SingleFilePatch}; -use regex::bytes::Regex; use std::num::ParseIntError; /// Errors that can occur while parsing a patch From 640c924d55ec83fd8facdef132e402ed02847b01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jelmer=20Vernoo=C4=B3?= Date: Sun, 17 Nov 2024 08:30:02 +0000 Subject: [PATCH 2/2] Fix formatting --- src/ed.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/ed.rs b/src/ed.rs index 0ace722..477e875 100644 --- a/src/ed.rs +++ b/src/ed.rs @@ -10,9 +10,7 @@ pub struct EdPatch { impl crate::ContentPatch for EdPatch { fn apply_exact(&self, orig: &[u8]) -> Result, crate::ApplyError> { let lines = splitlines(orig).collect::>(); - let result = self - .apply(&lines) - .map_err(crate::ApplyError::Conflict)?; + let result = self.apply(&lines).map_err(crate::ApplyError::Conflict)?; Ok(result) } }