Skip to content

Commit abc1db0

Browse files
committed
Use match for readability
1 parent 096b578 commit abc1db0

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

gix-blame/src/lib.rs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -815,8 +815,9 @@ pub fn blame_file<E>(
815815
// None of the changes affected the file we’re currently blaming.
816816
continue;
817817
};
818-
let gix_diff::tree::recorder::Change::Modification { previous_oid, oid, .. } = modification else {
819-
if matches!(modification, gix_diff::tree::recorder::Change::Addition { .. }) {
818+
819+
match modification {
820+
gix_diff::tree::recorder::Change::Addition { .. } => {
820821
// Every line that has not been blamed yet on a commit, is expected to have been
821822
// added when the file was added to the repository.
822823
out.extend(lines_to_blame.iter().map(|hunk| {
@@ -833,13 +834,14 @@ pub fn blame_file<E>(
833834
lines_to_blame = vec![];
834835

835836
break;
836-
} else {
837-
todo!()
838837
}
839-
};
838+
gix_diff::tree::recorder::Change::Deletion { .. } => todo!(),
839+
gix_diff::tree::recorder::Change::Modification { previous_oid, oid, .. } => {
840+
let changes = get_changes(&odb, resource_cache, *oid, *previous_oid, file_path);
840841

841-
let changes = get_changes(&odb, resource_cache, *oid, *previous_oid, file_path);
842-
lines_to_blame = process_changes(&mut out, &lines_to_blame, &changes, suspect);
842+
lines_to_blame = process_changes(&mut out, &lines_to_blame, &changes, suspect);
843+
}
844+
}
843845
}
844846

845847
assert_eq!(lines_to_blame, vec![]);

0 commit comments

Comments
 (0)