Skip to content

Commit ef54ff9

Browse files
committed
Clippy
1 parent 0eab486 commit ef54ff9

File tree

2 files changed

+13
-12
lines changed

2 files changed

+13
-12
lines changed

src/lib.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ where
7272
pub fn input(&mut self, bytes: &[u8]) {
7373
if !bytes.is_empty() {
7474
if !self.used {
75-
self.hasher.update(&[0]);
75+
self.hasher.update([0]);
7676
self.used = true;
7777
}
7878
self.hasher.update(bytes);
@@ -146,6 +146,7 @@ where
146146
D: digest::Digest + digest::FixedOutput,
147147
{
148148
/// Create `RecursiveDigest` by configuring `RecursiveDigestBuilder`
149+
#[must_use]
149150
pub fn new() -> RecursiveDigestBuilder<
150151
D,
151152
Box<dyn Fn(&walkdir::DirEntry) -> bool>,
@@ -320,7 +321,7 @@ where
320321
.filter(|entry| {
321322
let rel_path = entry
322323
.path()
323-
.strip_prefix(&root_path)
324+
.strip_prefix(root_path)
324325
.expect("must be prefix");
325326
paths.contains(rel_path)
326327
})
@@ -341,7 +342,7 @@ pub fn get_recursive_digest_for_dir<
341342
.filter(|entry| {
342343
let rel_path = entry
343344
.path()
344-
.strip_prefix(&root_path)
345+
.strip_prefix(root_path)
345346
.expect("must be prefix");
346347
!rel_path_ignore_list.contains(rel_path)
347348
})

tests/sanity.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#![allow(deprecated)]
2-
use blake2;
2+
33
use crev_recursive_digest::DigestError;
44
use digest::Digest;
55
use std::{
@@ -22,7 +22,7 @@ fn sanity() -> Result<(), DigestError> {
2222

2323
// File "recursive-digest-test/a/foo"
2424
let file_in_dir_path = dir_path.join("foo");
25-
let mut file_in_dir = fs::File::create(&file_in_dir_path)?;
25+
let mut file_in_dir = fs::File::create(file_in_dir_path)?;
2626
file_in_dir.write_all(msg)?;
2727
drop(file_in_dir);
2828

@@ -116,7 +116,7 @@ fn backward_comp() -> Result<(), DigestError> {
116116
)?;
117117

118118
assert_eq!(
119-
hex::encode(&dir_digest),
119+
hex::encode(dir_digest),
120120
"bc97399633e1228a563d57adecf98810364526a8e7bfc24b89985c5607e77605575d10989d5954b762af45c498129854dca603688fd63bd580bbf952c650b735"
121121
);
122122
tmp_dir.into_path();
@@ -158,12 +158,12 @@ fn test_exclude_include_path() -> Result<(), DigestError> {
158158

159159
let foo_content = b"foo_content";
160160
let file_in_dir_path = tmp_dir.path().join("foo");
161-
let mut file_in_dir = fs::File::create(&file_in_dir_path)?;
161+
let mut file_in_dir = fs::File::create(file_in_dir_path)?;
162162
file_in_dir.write_all(foo_content)?;
163163

164164
let bar_content = b"bar_content";
165165
let file_in_dir_path_2 = tmp_dir.path().join("bar");
166-
let mut file_in_dir_2 = fs::File::create(&file_in_dir_path_2)?;
166+
let mut file_in_dir_2 = fs::File::create(file_in_dir_path_2)?;
167167
file_in_dir_2.write_all(bar_content)?;
168168

169169
let expected = {
@@ -187,7 +187,7 @@ fn test_exclude_include_path() -> Result<(), DigestError> {
187187
excluded.insert(Path::new("foo").to_path_buf());
188188
assert_eq!(
189189
crev_recursive_digest::get_recursive_digest_for_dir::<blake2::Blake2b, _>(
190-
&tmp_dir.path(),
190+
tmp_dir.path(),
191191
&excluded
192192
)?,
193193
expected
@@ -197,7 +197,7 @@ fn test_exclude_include_path() -> Result<(), DigestError> {
197197
included.insert(Path::new("bar").to_path_buf());
198198
assert_eq!(
199199
crev_recursive_digest::get_recursive_digest_for_paths::<blake2::Blake2b, _>(
200-
&tmp_dir.path(),
200+
tmp_dir.path(),
201201
included
202202
)?,
203203
expected
@@ -213,8 +213,8 @@ fn ignore_dir() -> Result<(), DigestError> {
213213
let d1 = tmp_dir.path().join("d1");
214214
let d2 = tmp_dir.path().join("d2");
215215

216-
fs::create_dir_all(&d1.join("a/b1/c/d"))?;
217-
fs::create_dir_all(&d1.join("a/b2/c/d"))?;
216+
fs::create_dir_all(d1.join("a/b1/c/d"))?;
217+
fs::create_dir_all(d1.join("a/b2/c/d"))?;
218218
fs::create_dir_all(&d2)?;
219219

220220
let excluded_empty = HashSet::new();

0 commit comments

Comments
 (0)