diff --git a/src/main.rs b/src/main.rs index 6034c1b..4ed0c8f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -78,19 +78,18 @@ fn main() -> anyhow::Result<()> { Ok(()) } -struct EntryScanner<'repo, 'a, C, P> { - current_tree: C, - parent_tree: P, +struct EntryScanner<'repo, 'a, I> { + current_tree: I, current_entry: Option>, + parent_tree: I, parent_entry: Option>, } -impl<'repo, 'a, C, P> EntryScanner<'repo, 'a, C, P> +impl<'repo, 'a, I> EntryScanner<'repo, 'a, I> where - C: Iterator, DecodeError>>, - P: Iterator, DecodeError>>, + I: Iterator, DecodeError>>, { - pub fn new(current_tree: C, parent_tree: P) -> Result { + pub fn new(current_tree: I, parent_tree: I) -> Result { let mut this = Self { current_tree, parent_tree, @@ -129,10 +128,8 @@ where while !self.is_complete() { match (&self.current_entry, &self.parent_entry) { (None, None) => break, - (Some(head_entry), Some(parent_entry)) - if head_entry.filename() == parent_entry.filename() => - { - if head_entry.id() != parent_entry.id() { + (Some(current), Some(parent)) if current.filename() == parent.filename() => { + if current.id() != parent.id() { return Ok(self .advance_both()? .0 @@ -141,8 +138,8 @@ where self.advance_both()?; continue; } - (Some(head_entry), Some(parent_entry)) => { - if head_entry.filename() < parent_entry.filename() { + (Some(current), Some(parent)) => { + if current.filename() < parent.filename() { return Ok(self .advance_current()? .map(|entry| Change::Create(entry.detach())));