Skip to content

Commit 85b060c

Browse files
authored
Merge pull request #1901 from cruessler/make-either-copy
Derive Clone and Copy for Either
2 parents 0ba3147 + 3c1b1df commit 85b060c

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

gix-blame/src/file/function.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ pub fn file(
103103
let (mut buf, mut buf2) = (Vec::new(), Vec::new());
104104
let commit = find_commit(cache.as_ref(), &odb, &suspect, &mut buf)?;
105105
let mut queue: gix_revwalk::PriorityQueue<CommitTime, ObjectId> = gix_revwalk::PriorityQueue::new();
106-
queue.insert(commit_time(&commit)?, suspect);
106+
queue.insert(commit_time(commit)?, suspect);
107107

108108
let mut out = Vec::new();
109109
let mut diff_state = gix_diff::tree::State::default();
@@ -122,7 +122,7 @@ pub fn file(
122122
}
123123

124124
let commit = find_commit(cache.as_ref(), &odb, &suspect, &mut buf)?;
125-
let commit_time = commit_time(&commit)?;
125+
let commit_time = commit_time(commit)?;
126126

127127
if let Some(since) = options.since {
128128
if commit_time < since.seconds {
@@ -669,7 +669,7 @@ fn find_path_entry_in_commit(
669669

670670
type CommitTime = i64;
671671

672-
fn commit_time(commit: &gix_traverse::commit::Either<'_, '_>) -> Result<CommitTime, gix_object::decode::Error> {
672+
fn commit_time(commit: gix_traverse::commit::Either<'_, '_>) -> Result<CommitTime, gix_object::decode::Error> {
673673
match commit {
674674
gix_traverse::commit::Either::CommitRefIter(commit_ref_iter) => {
675675
commit_ref_iter.committer().map(|c| c.time.seconds)

gix-traverse/src/commit/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ pub struct Info {
6969

7070
/// Information about a commit that can be obtained either from a [`gix_object::CommitRefIter`] or
7171
/// a [`gix_commitgraph::file::Commit`].
72+
#[derive(Clone, Copy)]
7273
pub enum Either<'buf, 'cache> {
7374
/// See [`gix_object::CommitRefIter`].
7475
CommitRefIter(gix_object::CommitRefIter<'buf>),

0 commit comments

Comments
 (0)