…but it doesn't work because it thinks there is a destructor present, even though it's not. These are implemented for Rc/Box/Arc versions of the iterator, but not for the bare one.
Showing the changes to git-diff/src (1 of 1 file). Show all
Unified · Split
| @@ -51,8 +51,8 @@ impl<'a> visit::Changes<'a> { · 50 unmodified lines | |||
| 51 | R: visit::Record, | 51 | R: visit::Record, |
| 52 | { | 52 | { |
| 53 | state.clear(); | 53 | state.clear(); |
| 54 | let mut lhs_entries = self.0.take().unwrap_or_default(); | 54 | let mut lhs_entries = self.0.take().unwrap_or_default().peekable(); |
| 55 | let mut rhs_entries = other; | 55 | let mut rhs_entries = other.peekable(); |
| 56 | let mut avoid_popping_path: Option<()> = None; | 56 | let mut avoid_popping_path: Option<()> = None; |
| 57 | 57 | ||
| 58 | dbg!("================= START ==================="); | 58 | dbg!("================= START ==================="); |
| @@ -65,16 +65,24 @@ impl<'a> visit::Changes<'a> { · 6 unmodified lines | |||
| 65 | match state.trees.pop_front() { | 65 | match state.trees.pop_front() { |
| 66 | Some((None, Some(rhs))) => { | 66 | Some((None, Some(rhs))) => { |
| 67 | delegate.set_current_path(rhs.parent_path_id.clone()); | 67 | delegate.set_current_path(rhs.parent_path_id.clone()); |
| 68 | rhs_entries = locate(&rhs.tree_id, &mut state.buf2).ok_or(Error::NotFound(rhs.tree_id))?; | 68 | rhs_entries = locate(&rhs.tree_id, &mut state.buf2) |
| 69 | .ok_or(Error::NotFound(rhs.tree_id))? | ||
| 70 | .peekable(); | ||
| 69 | } | 71 | } |
| 70 | Some((Some(lhs), Some(rhs))) => { | 72 | Some((Some(lhs), Some(rhs))) => { |
| 71 | delegate.set_current_path(lhs.parent_path_id.clone()); | 73 | delegate.set_current_path(lhs.parent_path_id.clone()); |
| 72 | lhs_entries = locate(&lhs.tree_id, &mut state.buf1).ok_or(Error::NotFound(lhs.tree_id))?; | 74 | lhs_entries = locate(&lhs.tree_id, &mut state.buf1) |
| 73 | rhs_entries = locate(&rhs.tree_id, &mut state.buf2).ok_or(Error::NotFound(rhs.tree_id))?; | 75 | .ok_or(Error::NotFound(lhs.tree_id))? |
| 76 | .peekable(); | ||
| 77 | rhs_entries = locate(&rhs.tree_id, &mut state.buf2) | ||
| 78 | .ok_or(Error::NotFound(rhs.tree_id))? | ||
| 79 | .peekable(); | ||
| 74 | } | 80 | } |
| 75 | Some((Some(lhs), None)) => { | 81 | Some((Some(lhs), None)) => { |
| 76 | delegate.set_current_path(lhs.parent_path_id.clone()); | 82 | delegate.set_current_path(lhs.parent_path_id.clone()); |
| 77 | lhs_entries = locate(&lhs.tree_id, &mut state.buf1).ok_or(Error::NotFound(lhs.tree_id))?; | 83 | lhs_entries = locate(&lhs.tree_id, &mut state.buf1) |
| 84 | .ok_or(Error::NotFound(lhs.tree_id))? | ||
| 85 | .peekable(); | ||
| 78 | } | 86 | } |
| 79 | Some((None, None)) => unreachable!("BUG: it makes no sense to fill the stack with empties"), | 87 | Some((None, None)) => unreachable!("BUG: it makes no sense to fill the stack with empties"), |
| 80 | None => return Ok(()), | 88 | None => return Ok(()), |
| @@ -189,13 +197,13 @@ impl<'a> visit::Changes<'a> { · 108 unmodified lines | |||
| 189 | }; | 197 | }; |
| 190 | } | 198 | } |
| 191 | Less => { | 199 | Less => { |
| 192 | let mut cursor = lhs; | 200 | let cursor = lhs; |
| 193 | loop { | 201 | loop { |
| 194 | delete_entry_schedule_recursion(&cursor, &mut state.trees, delegate)?; | 202 | delete_entry_schedule_recursion(&cursor, &mut state.trees, delegate)?; |
| 195 | 203 | ||
| 196 | match lhs_entries.next() { | 204 | match lhs_entries.next() { |
| 197 | Some(entry) => { | 205 | Some(entry) => { |
| 198 | let entry = entry?; | 206 | let _entry = entry?; |
| 199 | // if entry.filename == rhs. | 207 | // if entry.filename == rhs. |
| 200 | todo!("peek entry, see if we caught up, ") | 208 | todo!("peek entry, see if we caught up, ") |
| 201 | } | 209 | } |