Skip to content

Commit b2121bc

Browse files
committed
refactor
all just minor tweaks.
1 parent ee6f5cc commit b2121bc

File tree

2 files changed

+9
-11
lines changed

2 files changed

+9
-11
lines changed

gix-blame/src/file/mod.rs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -325,8 +325,8 @@ fn process_change(
325325
/// `process_changes` assumes that ranges coming from the same *Source File* can and do
326326
/// occasionally overlap. If it were a desirable property of the blame algorithm as a whole to
327327
/// never have two different lines from a *Blamed File* mapped to the same line in a *Source File*,
328-
/// this property would need to be enforced at a higher level than `process_changes` if which case
329-
/// the nested loops could potentially be flattened into one.
328+
/// this property would need to be enforced at a higher level than `process_changes`.
329+
/// Then the nested loops could potentially be flattened into one.
330330
fn process_changes(
331331
hunks_to_blame: Vec<UnblamedHunk>,
332332
changes: Vec<Change>,
@@ -335,13 +335,11 @@ fn process_changes(
335335
) -> Vec<UnblamedHunk> {
336336
let mut new_hunks_to_blame = Vec::new();
337337

338-
for hunk in hunks_to_blame {
339-
let mut hunk = Some(hunk);
340-
338+
for mut hunk in hunks_to_blame.into_iter().map(Some) {
341339
let mut offset_in_destination = Offset::Added(0);
342340

343-
let mut changes_iter = changes.iter();
344-
let mut change: Option<Change> = changes_iter.next().cloned();
341+
let mut changes_iter = changes.iter().cloned();
342+
let mut change = changes_iter.next();
345343

346344
loop {
347345
(hunk, change) = process_change(
@@ -353,7 +351,7 @@ fn process_changes(
353351
change,
354352
);
355353

356-
change = change.or_else(|| changes_iter.next().cloned());
354+
change = change.or_else(|| changes_iter.next());
357355

358356
if hunk.is_none() {
359357
break;

gix-blame/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
//!
55
//! * **Blamed File**
66
//! - The file as it exists in `HEAD`.
7-
//! - the initial state with all lines that we need to associate with a *Blamed File*.
7+
//! - the initial state with all lines that we need to associate with a *Source File*.
88
//! * **Source File**
9-
//! - A file at a version (i.e. commit) that introduces hunks into the final 'image'.
9+
//! - A file at a version (i.e., commit) that introduces hunks into the final 'image' of the *Blamed File*.
1010
//! * **Suspects**
1111
//! - The versions of the files that can contain hunks that we could use in the final 'image'
1212
//! - multiple at the same time as the commit-graph may split up.
13-
//! - turns into *Source File* once we have found an association into the *Blamed File*.
13+
//! - They turn into a *Source File* once we have found an association into the *Blamed File*.
1414
#![deny(rust_2018_idioms, missing_docs)]
1515
#![forbid(unsafe_code)]
1616

0 commit comments

Comments
 (0)