Skip to content

Commit f90d772

Browse files
committed
thanks clippy
1 parent 946dd3a commit f90d772

File tree

3 files changed

+7
-10
lines changed

3 files changed

+7
-10
lines changed

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ doc: ## Run cargo doc on all crates
4949
cargo doc --features=max,lean,small
5050

5151
clippy: ## Run cargo clippy on all crates
52-
cargo clippy --all --tests
52+
cargo clippy --all --tests --examples
5353
cargo clippy --all --no-default-features --features small
5454
cargo clippy --all --no-default-features --features lean-async --tests
5555

git-repository/examples/stats.rs

+2-5
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,14 @@ use git_repository::Reference;
33

44
fn main() -> Result<(), Box<dyn std::error::Error>> {
55
let mut repo = git::discover(".")?.apply_environment();
6-
println!(
7-
"Repo: {}",
8-
repo.work_dir().as_deref().unwrap_or(repo.git_dir()).display()
9-
);
6+
println!("Repo: {}", repo.work_dir().unwrap_or_else(|| repo.git_dir()).display());
107
let mut max_commit_size = 0;
118
let mut avg_commit_size = 0;
129
repo.object_cache_size(32 * 1024);
1310
let commit_ids = repo
1411
.head()?
1512
.into_fully_peeled_id()
16-
.ok_or_else(|| "There are no commits - nothing to do here.")??
13+
.ok_or("There are no commits - nothing to do here.")??
1714
.ancestors()
1815
.all()?
1916
.inspect(|id| {

git-tempfile/examples/try-deadlock-on-cleanup.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use git_tempfile::{handle::Writable, AutoRemove, ContainingDirectory, Handle};
1212
fn main() -> Result<(), Box<dyn std::error::Error>> {
1313
let secs_to_run: usize = std::env::args()
1414
.nth(1)
15-
.ok_or_else(|| "the first argument is the amount of seconds to run")?
15+
.ok_or("the first argument is the amount of seconds to run")?
1616
.parse()?;
1717
let suspected_dashmap_block_size = 64;
1818
let tmp = tempfile::TempDir::new()?;
@@ -31,12 +31,12 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
3131
// Cause it to be repeatedly fetched from the registry for writing, causing high contention on the write lock
3232
// of the dashmap block it should be in.
3333
loop {
34-
if tfile
34+
let failed_to_mutably_access_file = tfile
3535
.with_mut(|_| {
3636
tempfiles_registry_locked.fetch_add(1, Ordering::SeqCst);
3737
})
38-
.is_err()
39-
{
38+
.is_err();
39+
if failed_to_mutably_access_file {
4040
// The cleanup handler runs continuously, so we create a new file once our current one is removed
4141
// This test is clearly limited by IOPS
4242
tfile = tempfile_for_thread_or_panic(tid, &tmp, &tempfiles_created);

0 commit comments

Comments
 (0)