Skip to content

Commit

Permalink
thanks clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
Byron committed Nov 5, 2023
1 parent 5761a4d commit 82b01c2
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 24 deletions.
4 changes: 2 additions & 2 deletions gix-diff/tests/tree/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ mod changes {
gix_diff::tree::Changes::from(lhs_tree).needed_to_obtain(
rhs_tree,
gix_diff::tree::State::default(),
&db,
db,
&mut recorder,
)?;
Ok(recorder.records)
Expand Down Expand Up @@ -104,7 +104,7 @@ mod changes {
gix_diff::tree::Changes::from(previous_tree).needed_to_obtain(
current_tree,
&mut gix_diff::tree::State::default(),
&db,
db,
&mut recorder,
)?;
Ok(recorder.records)
Expand Down
7 changes: 2 additions & 5 deletions gix-negotiate/tests/baseline/mod.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use std::cell::RefCell;

use gix_negotiate::Algorithm;
use gix_object::FindExt;
use gix_object::{bstr, bstr::ByteSlice};
use gix_object::{Find, FindExt};
use gix_ref::{file::ReferenceExt, store::WriteReflog};

#[test]
Expand Down Expand Up @@ -35,10 +35,7 @@ fn run() -> crate::Result {
.iter()
.filter_map(|name| {
refs.try_find(*name).expect("one tag per commit").map(|mut r| {
r.peel_to_id_in_place(&refs, &mut |id, buf| {
store.try_find(&id, buf).map(|d| d.map(|d| (d.kind, d.data)))
})
.expect("works");
r.peel_to_id_in_place(&refs, &store).expect("works");
r.target.into_id()
})
})
Expand Down
2 changes: 1 addition & 1 deletion gix-pack/src/data/output/count/objects/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ mod expand {
let objects = CountingObjects::new(db);
gix_diff::tree::Changes::from(Some(parent_tree))
.needed_to_obtain(
current_tree_iter.clone(),
current_tree_iter,
&mut tree_diff_state,
&objects,
&mut changes_delegate,
Expand Down
5 changes: 2 additions & 3 deletions gix-revwalk/src/graph/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -262,9 +262,8 @@ impl<'find, T> Graph<'find, T> {

/// Lookup `id` and return a handle to it, or fail if it doesn't exist or is no commit.
pub fn lookup(&mut self, id: &gix_hash::oid) -> Result<LazyCommit<'_>, gix_object::find::existing_iter::Error> {
Ok(self
.try_lookup(id)?
.ok_or(gix_object::find::existing_iter::Error::NotFound { oid: id.to_owned() })?)
self.try_lookup(id)?
.ok_or(gix_object::find::existing_iter::Error::NotFound { oid: id.to_owned() })
}
}

Expand Down
4 changes: 2 additions & 2 deletions gix-worktree-state/src/checkout/entry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ where

let object_size = match entry.mode {
gix_index::entry::Mode::FILE | gix_index::entry::Mode::FILE_EXECUTABLE => {
let obj = (&*objects)
let obj = (*objects)
.find_blob(&entry.id, buf)
.map_err(|err| crate::checkout::Error::Find {
err,
Expand Down Expand Up @@ -140,7 +140,7 @@ where
num_bytes
}
gix_index::entry::Mode::SYMLINK => {
let obj = (&*objects)
let obj = (*objects)
.find_blob(&entry.id, buf)
.map_err(|err| crate::checkout::Error::Find {
err,
Expand Down
3 changes: 1 addition & 2 deletions gix/src/clone/fetch/util.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use std::{borrow::Cow, convert::TryInto, io::Write};

use gix_object::Find;
use gix_ref::{
transaction::{LogChange, RefLog},
FullNameRef,
Expand Down Expand Up @@ -107,7 +106,7 @@ pub fn update_head(
repo.refs
.transaction()
.packed_refs(gix_ref::file::transaction::PackedRefs::DeletionsAndNonSymbolicUpdates(
Box::new(|oid, buf| repo.objects.try_find(&oid, buf).map(|obj| obj.map(|obj| obj.kind))),
Box::new(&repo.objects),
))
.prepare(
{
Expand Down
2 changes: 1 addition & 1 deletion gix/src/ext/tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ impl<'d> TreeIterExt for TreeRefIter<'d> {
StateMut: BorrowMut<breadthfirst::State>,
V: gix_traverse::tree::Visit,
{
breadthfirst(self.clone(), state, objects, delegate)
breadthfirst(*self, state, objects, delegate)
}
}

Expand Down
4 changes: 2 additions & 2 deletions gix/src/reference/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ impl<'repo> Reference<'repo> {
///
/// This is useful to learn where this reference is ultimately pointing to.
pub fn peel_to_id_in_place(&mut self) -> Result<Id<'repo>, peel::Error> {
let oid = self.inner.peel_to_id_in_place(&&self.repo.refs, &self.repo.objects)?;
Ok(Id::from_id(oid, &self.repo))
let oid = self.inner.peel_to_id_in_place(&self.repo.refs, &self.repo.objects)?;
Ok(Id::from_id(oid, self.repo))
}

/// Similar to [`peel_to_id_in_place()`][Reference::peel_to_id_in_place()], but consumes this instance.
Expand Down
8 changes: 2 additions & 6 deletions gix/src/remote/connection/fetch/update_refs/mod.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#![allow(clippy::result_large_err)]
use std::{collections::BTreeMap, convert::TryInto, path::PathBuf};

use gix_object::{Exists, Find};
use gix_object::Exists;
use gix_ref::{
transaction::{Change, LogChange, PreviousValue, RefEdit, RefLog},
Target, TargetRef,
Expand Down Expand Up @@ -325,11 +325,7 @@ pub(crate) fn update(
.packed_refs(
match write_packed_refs {
fetch::WritePackedRefs::Only => {
gix_ref::file::transaction::PackedRefs::DeletionsAndNonSymbolicUpdatesRemoveLooseSourceReference(Box::new(|oid, buf| {
repo.objects
.try_find(&oid, buf)
.map(|obj| obj.map(|obj| obj.kind))
}))},
gix_ref::file::transaction::PackedRefs::DeletionsAndNonSymbolicUpdatesRemoveLooseSourceReference(Box::new(&repo.objects))},
fetch::WritePackedRefs::Never => gix_ref::file::transaction::PackedRefs::DeletionsOnly
}
)
Expand Down

0 comments on commit 82b01c2

Please sign in to comment.