From 7bfcd43dfee7bd2fed94e92e318612457c0a019b Mon Sep 17 00:00:00 2001 From: aawsome <37850842+aawsome@users.noreply.github.com> Date: Sun, 29 Oct 2023 07:08:24 +0100 Subject: [PATCH] fix clippy lints (#29) --- src/blob/tree.rs | 5 +---- src/commands/restore.rs | 2 +- src/repofile/indexfile.rs | 2 +- src/repofile/snapshotfile.rs | 2 +- 4 files changed, 4 insertions(+), 7 deletions(-) diff --git a/src/blob/tree.rs b/src/blob/tree.rs index 1cde0638..e3e06ec3 100644 --- a/src/blob/tree.rs +++ b/src/blob/tree.rs @@ -596,10 +596,7 @@ pub(crate) fn merge_trees( } impl PartialOrd for SortedNode { fn partial_cmp(&self, other: &Self) -> Option { - self.0 - .name - .partial_cmp(&other.0.name) - .map(std::cmp::Ordering::reverse) + Some(self.cmp(other)) } } impl Eq for SortedNode {} diff --git a/src/commands/restore.rs b/src/commands/restore.rs index 9a2fbb0c..9f3396f7 100644 --- a/src/commands/restore.rs +++ b/src/commands/restore.rs @@ -684,7 +684,7 @@ impl RestorePlan { .as_mut() .map_or(false, |file| id.blob_matches_reader(length as usize, file)); - let blob_location = self.r.entry((ie.pack, bl)).or_insert_with(Vec::new); + let blob_location = self.r.entry((ie.pack, bl)).or_default(); blob_location.push(FileLocation { file_idx, file_start: file_pos, diff --git a/src/repofile/indexfile.rs b/src/repofile/indexfile.rs index f93bf426..fdc63a48 100644 --- a/src/repofile/indexfile.rs +++ b/src/repofile/indexfile.rs @@ -138,7 +138,7 @@ impl PartialOrd for IndexBlob { /// /// The ordering of the two blobs fn partial_cmp(&self, other: &Self) -> Option { - self.offset.partial_cmp(&other.offset) + Some(self.cmp(other)) } } diff --git a/src/repofile/snapshotfile.rs b/src/repofile/snapshotfile.rs index ae480870..0b55f7fc 100644 --- a/src/repofile/snapshotfile.rs +++ b/src/repofile/snapshotfile.rs @@ -776,7 +776,7 @@ impl Eq for SnapshotFile {} impl PartialOrd for SnapshotFile { fn partial_cmp(&self, other: &Self) -> Option { - self.time.partial_cmp(&other.time) + Some(self.cmp(other)) } } impl Ord for SnapshotFile {