Skip to content

Commit e1964e4

Browse files
committed
thanks clippy
Of Rust 1.54
1 parent ce0b81e commit e1964e4

File tree

38 files changed

+60
-63
lines changed

38 files changed

+60
-63
lines changed

experiments/hash-owned-borrowed/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ impl AsRef<Borrowed> for Owned {
3838
fn as_ref(&self) -> &Borrowed {
3939
match self {
4040
Owned::Sha1(b) => Borrowed::from_bytes(b.as_ref()),
41-
Owned::Sha256(b) => Borrowed::from_bytes(&b.as_ref()),
41+
Owned::Sha256(b) => Borrowed::from_bytes(b.as_ref()),
4242
}
4343
}
4444
}

experiments/traversal/src/main.rs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ fn main() -> anyhow::Result<()> {
5353
let start = Instant::now();
5454
let (unique, entries) = do_gitoxide_tree_dag_traversal(
5555
&all_commits,
56-
&db,
56+
db,
5757
odb::pack::cache::lru::StaticLinkedList::<64>::default,
5858
*compute_mode,
5959
)?;
@@ -85,7 +85,7 @@ fn main() -> anyhow::Result<()> {
8585
);
8686

8787
let start = Instant::now();
88-
let count = do_gitoxide_commit_graph_traversal(commit_id, &db, || {
88+
let count = do_gitoxide_commit_graph_traversal(commit_id, db, || {
8989
odb::pack::cache::lru::MemoryCappedHashmap::new(GITOXIDE_CACHED_OBJECT_DATA_PER_THREAD_IN_BYTES)
9090
})?;
9191
let elapsed = start.elapsed();
@@ -101,7 +101,7 @@ fn main() -> anyhow::Result<()> {
101101
let start = Instant::now();
102102
let count = do_gitoxide_commit_graph_traversal(
103103
commit_id,
104-
&db,
104+
db,
105105
odb::pack::cache::lru::StaticLinkedList::<GITOXIDE_STATIC_CACHE_SIZE>::default,
106106
)?;
107107
let elapsed = start.elapsed();
@@ -115,7 +115,7 @@ fn main() -> anyhow::Result<()> {
115115
);
116116

117117
let start = Instant::now();
118-
let count = do_gitoxide_commit_graph_traversal(commit_id, &db, || odb::pack::cache::Never)?;
118+
let count = do_gitoxide_commit_graph_traversal(commit_id, db, || odb::pack::cache::Never)?;
119119
let elapsed = start.elapsed();
120120
let objs_per_sec = |elapsed: Duration| count as f32 / elapsed.as_secs_f32();
121121
println!(
@@ -267,10 +267,7 @@ where
267267
let seen = &seen;
268268
move || {
269269
(
270-
Count {
271-
entries: 0,
272-
seen: &seen,
273-
},
270+
Count { entries: 0, seen },
274271
Vec::<u8>::new(),
275272
Vec::<u8>::new(),
276273
new_cache(),

git-commitgraph/src/file/access.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ impl File {
8585
let mid_sha = self.id_at(file::Position(mid));
8686

8787
use std::cmp::Ordering::*;
88-
match id.cmp(&mid_sha) {
88+
match id.cmp(mid_sha) {
8989
Less => upper_bound = mid,
9090
Equal => return Some(file::Position(mid)),
9191
Greater => lower_bound = mid + 1,

git-config/src/file.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1030,7 +1030,7 @@ impl<'lookup, 'event> MutableMultiValue<'_, 'lookup, 'event> {
10301030
/// This will panic if the index is out of range.
10311031
#[inline]
10321032
pub fn set_string(&mut self, index: usize, input: String) {
1033-
self.set_bytes(index, input.into_bytes())
1033+
self.set_bytes(index, input.into_bytes());
10341034
}
10351035

10361036
/// Sets the value at the given index.
@@ -1040,7 +1040,7 @@ impl<'lookup, 'event> MutableMultiValue<'_, 'lookup, 'event> {
10401040
/// This will panic if the index is out of range.
10411041
#[inline]
10421042
pub fn set_bytes(&mut self, index: usize, input: Vec<u8>) {
1043-
self.set_value(index, Cow::Owned(input))
1043+
self.set_value(index, Cow::Owned(input));
10441044
}
10451045

10461046
/// Sets the value at the given index.
@@ -1099,7 +1099,7 @@ impl<'lookup, 'event> MutableMultiValue<'_, 'lookup, 'event> {
10991099
/// input for all values.
11001100
#[inline]
11011101
pub fn set_str_all(&mut self, input: &str) {
1102-
self.set_owned_values_all(input.as_bytes())
1102+
self.set_owned_values_all(input.as_bytes());
11031103
}
11041104

11051105
/// Sets all values in this multivar to the provided one by copying the
@@ -1721,7 +1721,7 @@ impl<'event> GitConfig<'event> {
17211721
}
17221722
}
17231723
if !found_node {
1724-
lookup.push(LookupTreeNode::Terminal(vec![new_section_id]))
1724+
lookup.push(LookupTreeNode::Terminal(vec![new_section_id]));
17251725
}
17261726
}
17271727
self.section_order.push_back(new_section_id);

git-hash/src/owned.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ impl ObjectId {
7070
/// Panics if this instance is not a sha1 hash.
7171
pub fn sha1(&self) -> &[u8; SIZE_OF_SHA1_DIGEST] {
7272
match self {
73-
Self::Sha1(b) => &b,
73+
Self::Sha1(b) => b,
7474
}
7575
}
7676

git-object/src/immutable/commit/decode.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ pub fn message<'a, E: ParseError<&'a [u8]> + ContextError<&'a [u8]>>(i: &'a [u8]
2626
)));
2727
}
2828
let (i, _) = context("a newline separates headers from the message", tag(NL))(i)?;
29-
Ok((&[], &i.as_bstr()))
29+
Ok((&[], i.as_bstr()))
3030
}
3131

3232
pub fn commit<'a, E: ParseError<&'a [u8]> + ContextError<&'a [u8]>>(i: &'a [u8]) -> IResult<&'a [u8], Commit<'_>, E> {

git-object/src/immutable/tag.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ mod decode {
9898
}
9999
// an empty signature message signals that there is none - the function signature is needed
100100
// to work with 'alt(…)'. PGP signatures are never empty
101-
Ok((&[], (&i, &[])))
101+
Ok((&[], (i, &[])))
102102
}
103103
let (i, (message, signature)) = alt((
104104
tuple((

git-object/src/mutable/convert.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ impl From<immutable::Tag<'_>> for mutable::Tag {
1111
pgp_signature,
1212
} = other;
1313
mutable::Tag {
14-
target: git_hash::ObjectId::from_hex(&target).expect("40 bytes hex sha1"),
14+
target: git_hash::ObjectId::from_hex(target).expect("40 bytes hex sha1"),
1515
name: name.to_owned(),
1616
target_kind,
1717
message: message.to_owned(),
@@ -33,7 +33,7 @@ impl From<immutable::Commit<'_>> for mutable::Commit {
3333
extra_headers,
3434
} = other;
3535
mutable::Commit {
36-
tree: git_hash::ObjectId::from_hex(&tree).expect("40 bytes hex sha1"),
36+
tree: git_hash::ObjectId::from_hex(tree).expect("40 bytes hex sha1"),
3737
parents: parents
3838
.iter()
3939
.map(|parent| git_hash::ObjectId::from_hex(parent).expect("40 bytes hex sha1"))

git-object/src/mutable/tag.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ impl Tag {
5858
}
5959
if let Some(ref message) = self.pgp_signature {
6060
out.write_all(NL)?;
61-
out.write_all(&message)?;
61+
out.write_all(message)?;
6262
}
6363
Ok(())
6464
}

git-object/src/mutable/tree.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ impl Tree {
9090
if filename.find_byte(b'\n').is_some() {
9191
return Err(Error::NewlineInFilename(filename.to_owned()).into());
9292
}
93-
out.write_all(&filename)?;
93+
out.write_all(filename)?;
9494
out.write_all(&[b'\0'])?;
9595

9696
out.write_all(oid.as_bytes())?;

git-object/src/types.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ quick_error! {
1717
#[allow(missing_docs)]
1818
pub enum Error {
1919
InvalidObjectKind(kind: crate::BString) {
20-
display("Unknown object kind: {:?}", std::str::from_utf8(&kind))
20+
display("Unknown object kind: {:?}", std::str::from_utf8(kind))
2121
}
2222
}
2323
}

git-odb/src/alternate/parse.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use std::{borrow::Cow, path::PathBuf};
66
#[derive(thiserror::Error, Debug)]
77
#[allow(missing_docs)]
88
pub enum Error {
9-
#[error("Could not obtain an object path for the alternate directory '{}'", String::from_utf8_lossy(&.0))]
9+
#[error("Could not obtain an object path for the alternate directory '{}'", String::from_utf8_lossy(.0))]
1010
PathConversion(Vec<u8>),
1111
#[error("Could not unquote alternate path")]
1212
Unquote(#[from] unquote::Error),

git-odb/src/alternate/unquote.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ use std::io::Read;
44

55
#[derive(thiserror::Error, Debug)]
66
pub enum Error {
7-
#[error("{message}: {:?}", String::from_utf8_lossy(&.input))]
7+
#[error("{message}: {:?}", String::from_utf8_lossy(.input))]
88
InvalidInput { message: String, input: Vec<u8> },
9-
#[error("Invalid escaped value {byte} in input {:?}", String::from_utf8_lossy(&.input))]
9+
#[error("Invalid escaped value {byte} in input {:?}", String::from_utf8_lossy(.input))]
1010
UnsupportedEscapeByte { byte: u8, input: Vec<u8> },
1111
}
1212

git-odb/src/store/linked/iter.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,6 @@ impl linked::Store {
120120
///
121121
/// Useful in conjunction with `'static threads`.
122122
pub fn arc_iter(self: &Arc<linked::Store>) -> AllObjects<Arc<linked::Store>> {
123-
AllObjects::new(Arc::clone(&self))
123+
AllObjects::new(Arc::clone(self))
124124
}
125125
}

git-pack/src/bundle/write/error.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ pub enum Error {
77
#[error(transparent)]
88
PackIter(#[from] crate::data::input::Error),
99
#[error("Could not move a temporary file into its desired place")]
10-
PeristError(#[from] tempfile::PersistError),
10+
Perist(#[from] tempfile::PersistError),
1111
#[error(transparent)]
1212
IndexWrite(#[from] crate::index::write::Error),
1313
}

git-pack/src/data/input/entry.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ impl input::Entry {
77
/// This method is useful when arbitrary base entries are created
88
pub fn from_data_obj(obj: &data::Object<'_>, pack_offset: u64) -> Result<Self, input::Error> {
99
let header = to_header(obj.kind);
10-
let compressed = compress_data(&obj)?;
10+
let compressed = compress_data(obj)?;
1111
let compressed_size = compressed.len() as u64;
1212
let mut entry = input::Entry {
1313
header,

git-pack/src/data/object.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ pub mod verify {
9090
let mut sink = hash::Write::new(io::sink(), desired.kind());
9191

9292
loose::object::header::encode(self.kind, self.data.len() as u64, &mut sink).expect("hash to always work");
93-
sink.hash.update(&self.data);
93+
sink.hash.update(self.data);
9494

9595
let actual_id = git_hash::ObjectId::from(sink.hash.digest());
9696
if desired != actual_id {

git-pack/src/data/output/count/iter_from_objects.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ where
148148
push_obj_count_unique(
149149
&mut out,
150150
seen_objs,
151-
&commit_id,
151+
commit_id,
152152
&parent_commit_obj,
153153
progress,
154154
stats,
@@ -370,7 +370,7 @@ fn push_obj_count_unique(
370370
if count_expanded {
371371
statistics.expanded_objects += 1;
372372
}
373-
out.push(output::Count::from_data(id, &obj));
373+
out.push(output::Count::from_data(id, obj));
374374
}
375375
}
376376

@@ -404,7 +404,7 @@ mod util {
404404
fn next(&mut self) -> Option<Self::Item> {
405405
let mut res = Vec::with_capacity(self.size);
406406
let mut items_left = self.size;
407-
while let Some(item) = self.iter.next() {
407+
for item in &mut self.iter {
408408
res.push(item);
409409
items_left -= 1;
410410
if items_left == 0 {

git-pack/src/index/access.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ impl index::File {
137137
let mid_sha = self.oid_at_index(mid);
138138

139139
use std::cmp::Ordering::*;
140-
match id.cmp(&mid_sha) {
140+
match id.cmp(mid_sha) {
141141
Less => upper_bound = mid,
142142
Equal => return Some(mid),
143143
Greater => lower_bound = mid + 1,

git-pack/src/index/traverse/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ impl index::File {
189189
process_entry(
190190
check,
191191
object_kind,
192-
&buf,
192+
buf,
193193
progress,
194194
header_buf,
195195
index_entry,
@@ -244,5 +244,5 @@ where
244244
}
245245
}
246246
}
247-
processor(object_kind, decompressed, &index_entry, progress).map_err(Error::Processor)
247+
processor(object_kind, decompressed, index_entry, progress).map_err(Error::Processor)
248248
}

git-pack/src/index/traverse/reduce.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ where
4646
..Default::default()
4747
};
4848
Reducer {
49-
progress: &progress,
49+
progress,
5050
check,
5151
then: Instant::now(),
5252
entries_seen: 0,

git-pack/src/index/write/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,6 @@ fn modify_base(
231231
}
232232

233233
let object_kind = pack_entry.header.as_kind().expect("base object as source of iteration");
234-
let id = compute_hash(object_kind, &decompressed, hash);
234+
let id = compute_hash(object_kind, decompressed, hash);
235235
entry.id = id;
236236
}

git-pack/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ pub use crate::bundle::Bundle;
1919

2020
///
2121
pub mod find;
22-
pub use find::{Find, FindExt};
2322
#[doc(inline)]
23+
pub use find::{Find, FindExt};
2424

2525
///
2626
pub mod cache;

git-pack/src/tree/traverse/resolve.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ fn decompress_all_at_once(b: &[u8], decompressed_len: usize) -> Result<Vec<u8>,
103103
let mut out = Vec::new();
104104
out.resize(decompressed_len, 0);
105105
zlib::Inflate::default()
106-
.once(&b, &mut out)
106+
.once(b, &mut out)
107107
.map_err(|err| Error::ZlibInflate {
108108
source: err,
109109
message: "Failed to decompress entry",

git-packetline/src/read/async_io.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ where
102102
let (is_done, stopped_at, res) = Self::read_line_inner_exhaustive(
103103
&mut self.read,
104104
&mut self.buf,
105-
&self.delimiters,
105+
self.delimiters,
106106
self.fail_on_err_lines,
107107
false,
108108
)
@@ -125,7 +125,7 @@ where
125125
let (is_done, stopped_at, res) = Self::read_line_inner_exhaustive(
126126
&mut self.read,
127127
&mut self.peek_buf,
128-
&self.delimiters,
128+
self.delimiters,
129129
self.fail_on_err_lines,
130130
true,
131131
)

git-packetline/src/read/blocking_io.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ where
9696
let (is_done, stopped_at, res) = Self::read_line_inner_exhaustive(
9797
&mut self.read,
9898
&mut self.buf,
99-
&self.delimiters,
99+
self.delimiters,
100100
self.fail_on_err_lines,
101101
false,
102102
);
@@ -118,7 +118,7 @@ where
118118
let (is_done, stopped_at, res) = Self::read_line_inner_exhaustive(
119119
&mut self.read,
120120
&mut self.peek_buf,
121-
&self.delimiters,
121+
self.delimiters,
122122
self.fail_on_err_lines,
123123
true,
124124
);

git-protocol/src/fetch/arguments/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ impl Arguments {
113113
pub fn deepen_not(&mut self, ref_path: &BStr) {
114114
assert!(self.deepen_not, "'deepen-not' feature required");
115115
let mut line = BString::from("deepen-not ");
116-
line.extend_from_slice(&ref_path);
116+
line.extend_from_slice(ref_path);
117117
self.args.push(line);
118118
}
119119
/// Set the given filter `spec` when listing references.

git-protocol/src/fetch/response/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ impl Response {
196196
shallows: &mut Vec<ShallowUpdate>,
197197
peeked_line: &str,
198198
) -> bool {
199-
match Acknowledgement::from_line(&peeked_line) {
199+
match Acknowledgement::from_line(peeked_line) {
200200
Ok(ack) => match ack.id() {
201201
Some(id) => {
202202
if !acks.iter().any(|a| a.id() == Some(id)) {
@@ -205,7 +205,7 @@ impl Response {
205205
}
206206
None => acks.push(ack),
207207
},
208-
Err(_) => match ShallowUpdate::from_line(&peeked_line) {
208+
Err(_) => match ShallowUpdate::from_line(peeked_line) {
209209
Ok(shallow) => {
210210
shallows.push(shallow);
211211
}

git-ref/src/mutable.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ impl Target {
9696
/// Interpret this owned Target as shared Target
9797
pub fn borrow(&self) -> crate::Target<'_> {
9898
match self {
99-
Target::Peeled(oid) => crate::Target::Peeled(&oid),
99+
Target::Peeled(oid) => crate::Target::Peeled(oid),
100100
Target::Symbolic(name) => crate::Target::Symbolic(name.0.as_bstr()),
101101
}
102102
}

0 commit comments

Comments
 (0)