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