Showing the changes to git-diff/src (1 of 3 files). Show all
Unified · Split
| @@ -5,7 +5,7 @@ use crate::{ · 4 unmodified lines | |||
| 5 | use git_hash::{oid, ObjectId}; | 5 | use git_hash::{oid, ObjectId}; |
| 6 | use git_object::{immutable, tree}; | 6 | use git_object::{immutable, tree}; |
| 7 | use quick_error::quick_error; | 7 | use quick_error::quick_error; |
| 8 | use std::collections::VecDeque; | 8 | use std::{borrow::BorrowMut, collections::VecDeque}; |
| 9 | 9 | ||
| 10 | quick_error! { | 10 | quick_error! { |
| 11 | #[derive(Debug)] | 11 | #[derive(Debug)] |
| @@ -42,17 +42,19 @@ impl<'a> visit::Changes<'a> { · 30 unmodified lines | |||
| 42 | /// * cycle checking is not performed, but can be performed in the delegate | 42 | /// * cycle checking is not performed, but can be performed in the delegate |
| 43 | /// * [ManuallyDrop] is used because `Peekable` is needed. When using it as wrapper around our no-drop iterators, all of the sudden | 43 | /// * [ManuallyDrop] is used because `Peekable` is needed. When using it as wrapper around our no-drop iterators, all of the sudden |
| 44 | /// borrowcheck complains as Drop is present (even though it's not) | 44 | /// borrowcheck complains as Drop is present (even though it's not) |
| 45 | pub fn needed_to_obtain<LocateFn, R>( | 45 | pub fn needed_to_obtain<LocateFn, R, StateMut>( |
| 46 | mut self, | 46 | mut self, |
| 47 | other: immutable::TreeIter<'a>, | 47 | other: immutable::TreeIter<'a>, |
| 48 | state: &mut visit::State<R::PathId>, | 48 | mut state: StateMut, |
| 49 | mut locate: LocateFn, | 49 | mut locate: LocateFn, |
| 50 | delegate: &mut R, | 50 | delegate: &mut R, |
| 51 | ) -> Result<(), Error> | 51 | ) -> Result<(), Error> |
| 52 | where | 52 | where |
| 53 | LocateFn: for<'b> FnMut(&oid, &'b mut Vec<u8>) -> Option<immutable::tree::TreeIter<'b>>, | 53 | LocateFn: for<'b> FnMut(&oid, &'b mut Vec<u8>) -> Option<immutable::tree::TreeIter<'b>>, |
| 54 | R: visit::Record, | 54 | R: visit::Record, |
| 55 | StateMut: BorrowMut<visit::State<R::PathId>>, | ||
| 55 | { | 56 | { |
| 57 | let state = state.borrow_mut(); | ||
| 56 | state.clear(); | 58 | state.clear(); |
| 57 | let mut lhs_entries = peekable(self.0.take().unwrap_or_default()); | 59 | let mut lhs_entries = peekable(self.0.take().unwrap_or_default()); |
| 58 | let mut rhs_entries = peekable(other); | 60 | let mut rhs_entries = peekable(other); |