From 4482bdb01295d7e8a5b9f78e40a25986c826759e Mon Sep 17 00:00:00 2001 From: Tanmay Patil Date: Sun, 5 May 2024 18:00:32 +0530 Subject: [PATCH] Fix clippy warnings --- src/context_diff.rs | 4 ++-- src/main.rs | 2 +- src/params.rs | 7 +++---- src/unified_diff.rs | 4 ++-- 4 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/context_diff.rs b/src/context_diff.rs index 28f6584..bf0329c 100644 --- a/src/context_diff.rs +++ b/src/context_diff.rs @@ -269,12 +269,12 @@ fn make_diff( #[must_use] pub fn diff(expected: &[u8], actual: &[u8], params: &Params) -> Vec { let from_modified_time = - match !params.stdin_path.is_empty() && params.from.to_string_lossy().starts_with("-") { + match !params.stdin_path.is_empty() && params.from.to_string_lossy().starts_with('-') { true => get_modification_time(¶ms.stdin_path.to_string_lossy()), false => get_modification_time(¶ms.from.to_string_lossy()), }; let to_modified_time = - match !params.stdin_path.is_empty() && params.to.to_string_lossy().starts_with("-") { + match !params.stdin_path.is_empty() && params.to.to_string_lossy().starts_with('-') { true => get_modification_time(¶ms.stdin_path.to_string_lossy()), false => get_modification_time(¶ms.to.to_string_lossy()), }; diff --git a/src/main.rs b/src/main.rs index 3aafa95..6261007 100644 --- a/src/main.rs +++ b/src/main.rs @@ -47,7 +47,7 @@ fn main() -> ExitCode { } // read files fn read_file_contents(filepath: &OsString, stdin_path: &OsString) -> io::Result> { - if filepath.to_string_lossy().starts_with("-") && !stdin_path.is_empty() { + if filepath.to_string_lossy().starts_with('-') && !stdin_path.is_empty() { fs::read(stdin_path) } else if filepath == "-" { let mut content = Vec::new(); diff --git a/src/params.rs b/src/params.rs index 0ff6f25..c37dcfb 100644 --- a/src/params.rs +++ b/src/params.rs @@ -190,12 +190,11 @@ pub fn parse_params>(opts: I) -> Result Vec { let from_modified_time = - match !params.stdin_path.is_empty() && params.from.to_string_lossy().starts_with("-") { + match !params.stdin_path.is_empty() && params.from.to_string_lossy().starts_with('-') { true => get_modification_time(¶ms.stdin_path.to_string_lossy()), false => get_modification_time(¶ms.from.to_string_lossy()), }; let to_modified_time = - match !params.stdin_path.is_empty() && params.to.to_string_lossy().starts_with("-") { + match !params.stdin_path.is_empty() && params.to.to_string_lossy().starts_with('-') { true => get_modification_time(¶ms.stdin_path.to_string_lossy()), false => get_modification_time(¶ms.to.to_string_lossy()), };