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
5454 let mut avoid_popping_path: Option<()> = None;
5555
5656 loop {
57− if !avoid_popping_path.take().is_some() {
57+ if avoid_popping_path.take().is_none() {
5858 delegate.pop_path_component();
5959 }
6060 match (lhs_entries.next(), rhs_entries.next()) {
6161 (None, None) => match state.trees.pop_front() {
6262 Some((None, Some(rhs))) => {
6363 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))?;
6665 avoid_popping_path = Some(());
6766 }
6867 None => return Ok(()),
@@ -77,8 +76,8 @@ impl<'a> visit::Changes<'a> { · 8 unmodified lines
7776 match (lhs.mode, rhs.mode) {
7877 (Tree, Tree) => {
7978 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
8281 .record(Change::Modification {
8382 previous_entry_mode: lhs.mode,
8483 previous_oid: lhs.oid.to_owned(),
@@ -86,9 +85,8 @@ impl<'a> visit::Changes<'a> { · 1 unmodified line
8685 oid: rhs.oid.to_owned(),
8786 })
8887 .cancelled()
89− {
90− return Err(Cancelled);
91− }
88+ {
89+ return Err(Cancelled);
9290 }
9391 todo!("schedule tree|tree iteration schedule the trees with stack")
9492 }
@@ -136,8 +134,8 @@ impl<'a> visit::Changes<'a> { · 41 unmodified lines
136134 (lhs_non_tree, rhs_non_tree) => {
137135 delegate.push_path_component(lhs.filename);
138136 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
141139 .record(Change::Modification {
142140 previous_entry_mode: lhs.mode,
143141 previous_oid: lhs.oid.to_owned(),
@@ -145,9 +143,8 @@ impl<'a> visit::Changes<'a> { · 1 unmodified line
145143 oid: rhs.oid.to_owned(),
146144 })
147145 .cancelled()
148− {
149− return Err(Error::Cancelled);
150− }
146+ {
147+ return Err(Error::Cancelled);
151148 }
152149 }
153150 };
git-diff/src/visit/mod.rs+3−1
@@ -6,9 +6,11 @@ use std::collections::VecDeque; · 5 unmodified lines
66 pub struct State<PathId: Default + Clone> {
77 buf1: Vec<u8>,
88 buf2: Vec<u8>,
9− trees: VecDeque<(Option<TreeInfo<PathId>>, Option<TreeInfo<PathId>>)>,
9+ trees: VecDeque<TreeInfoPair<PathId>>,
1010 }
1111
12+type TreeInfoPair<PathId> = (Option<TreeInfo<PathId>>, Option<TreeInfo<PathId>>);
13+
1214 #[derive(Clone)]
1315 pub(crate) struct TreeInfo<PathId: Clone> {
1416 pub tree_id: ObjectId,