Showing the changes to git-diff/src (2 of 2 files). Show all
Unified · Split
| @@ -54,15 +54,14 @@ impl<'a> visit::Changes<'a> { · 53 unmodified lines | ||
| 54 | 54 | let mut avoid_popping_path: Option<()> = None; |
| 55 | 55 | |
| 56 | 56 | loop { |
| 57 | − if !avoid_popping_path.take().is_some() { | |
| 57 | + if avoid_popping_path.take().is_none() { | |
| 58 | 58 | delegate.pop_path_component(); |
| 59 | 59 | } |
| 60 | 60 | match (lhs_entries.next(), rhs_entries.next()) { |
| 61 | 61 | (None, None) => match state.trees.pop_front() { |
| 62 | 62 | Some((None, Some(rhs))) => { |
| 63 | 63 | delegate.set_current_path(rhs.parent_path_id.clone()); |
| 64 | − rhs_entries = | |
| 65 | − locate(&rhs.tree_id, &mut state.buf2).ok_or_else(|| Error::NotFound(rhs.tree_id))?; | |
| 64 | + rhs_entries = locate(&rhs.tree_id, &mut state.buf2).ok_or(Error::NotFound(rhs.tree_id))?; | |
| 66 | 65 | avoid_popping_path = Some(()); |
| 67 | 66 | } |
| 68 | 67 | None => return Ok(()), |
| @@ -77,8 +76,8 @@ impl<'a> visit::Changes<'a> { · 8 unmodified lines | ||
| 77 | 76 | match (lhs.mode, rhs.mode) { |
| 78 | 77 | (Tree, Tree) => { |
| 79 | 78 | let _path_id = delegate.push_tracked_path_component(lhs.filename); |
| 80 | − if lhs.oid != rhs.oid { | |
| 81 | − if delegate | |
| 79 | + if lhs.oid != rhs.oid | |
| 80 | + && delegate | |
| 82 | 81 | .record(Change::Modification { |
| 83 | 82 | previous_entry_mode: lhs.mode, |
| 84 | 83 | previous_oid: lhs.oid.to_owned(), |
| @@ -86,9 +85,8 @@ impl<'a> visit::Changes<'a> { · 1 unmodified line | ||
| 86 | 85 | oid: rhs.oid.to_owned(), |
| 87 | 86 | }) |
| 88 | 87 | .cancelled() |
| 89 | − { | |
| 90 | − return Err(Cancelled); | |
| 91 | − } | |
| 88 | + { | |
| 89 | + return Err(Cancelled); | |
| 92 | 90 | } |
| 93 | 91 | todo!("schedule tree|tree iteration schedule the trees with stack") |
| 94 | 92 | } |
| @@ -136,8 +134,8 @@ impl<'a> visit::Changes<'a> { · 41 unmodified lines | ||
| 136 | 134 | (lhs_non_tree, rhs_non_tree) => { |
| 137 | 135 | delegate.push_path_component(lhs.filename); |
| 138 | 136 | debug_assert!(lhs_non_tree.is_no_tree() && rhs_non_tree.is_no_tree()); |
| 139 | − if lhs.oid != rhs.oid { | |
| 140 | − if delegate | |
| 137 | + if lhs.oid != rhs.oid | |
| 138 | + && delegate | |
| 141 | 139 | .record(Change::Modification { |
| 142 | 140 | previous_entry_mode: lhs.mode, |
| 143 | 141 | previous_oid: lhs.oid.to_owned(), |
| @@ -145,9 +143,8 @@ impl<'a> visit::Changes<'a> { · 1 unmodified line | ||
| 145 | 143 | oid: rhs.oid.to_owned(), |
| 146 | 144 | }) |
| 147 | 145 | .cancelled() |
| 148 | − { | |
| 149 | − return Err(Error::Cancelled); | |
| 150 | − } | |
| 146 | + { | |
| 147 | + return Err(Error::Cancelled); | |
| 151 | 148 | } |
| 152 | 149 | } |
| 153 | 150 | }; |
| @@ -6,9 +6,11 @@ use std::collections::VecDeque; · 5 unmodified lines | ||
| 6 | 6 | pub struct State<PathId: Default + Clone> { |
| 7 | 7 | buf1: Vec<u8>, |
| 8 | 8 | buf2: Vec<u8>, |
| 9 | − trees: VecDeque<(Option<TreeInfo<PathId>>, Option<TreeInfo<PathId>>)>, | |
| 9 | + trees: VecDeque<TreeInfoPair<PathId>>, | |
| 10 | 10 | } |
| 11 | 11 | |
| 12 | +type TreeInfoPair<PathId> = (Option<TreeInfo<PathId>>, Option<TreeInfo<PathId>>); | |
| 13 | + | |
| 12 | 14 | #[derive(Clone)] |
| 13 | 15 | pub(crate) struct TreeInfo<PathId: Clone> { |
| 14 | 16 | pub tree_id: ObjectId, |