From 4df7704ef5e14cdb46397fa7660f08d031c5e8dd Mon Sep 17 00:00:00 2001 From: Stephan Dilly Date: Sat, 2 May 2020 16:55:20 +0200 Subject: [PATCH] clippy fixes --- asyncgit/src/sync/diff.rs | 2 +- src/components/changes.rs | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/asyncgit/src/sync/diff.rs b/asyncgit/src/sync/diff.rs index 7fee1c15..197b18ce 100644 --- a/asyncgit/src/sync/diff.rs +++ b/asyncgit/src/sync/diff.rs @@ -173,7 +173,7 @@ pub fn get_diff(repo_path: &str, p: String, stage: bool) -> FileDiff { repo_path.join(delta.new_file().path().unwrap()); let newfile_content = new_file_content(&newfile_path) - .unwrap_or(String::from("file not found")); + .unwrap_or_else(|| String::from("file not found")); let mut patch = Patch::from_buffers( &[], diff --git a/src/components/changes.rs b/src/components/changes.rs index ab3edb39..fa8514db 100644 --- a/src/components/changes.rs +++ b/src/components/changes.rs @@ -166,7 +166,7 @@ impl ChangesComponent { match &item.kind { FileTreeItemKind::File(status_item) => { let status_char = - Self::item_status_char(&status_item.status); + Self::item_status_char(status_item.status); let file = Path::new(&status_item.path) .file_name() .unwrap() @@ -182,7 +182,7 @@ impl ChangesComponent { w = width as usize ) } else { - format!("{} {}{}", status_char, indent_str, file) //M + - R + format!("{} {}{}", status_char, indent_str, file) }; let mut style = @@ -239,7 +239,7 @@ impl ChangesComponent { } } - fn item_status_char(item_type: &Option) -> char { + fn item_status_char(item_type: Option) -> char { if let Some(item_type) = item_type { match item_type { StatusItemType::Modified => 'M',