History

thanks clippy

Sebastian Thiel committed 5 years ago

Commit c223e311 parent f86566c2 files · +13 −14Browse files

Showing the changes to git-diff/src (2 of 2 files). Show all

Unified · Split

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