Skip to content

Commit

Permalink
thanks clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
Byron committed Oct 17, 2022
1 parent d2ebe34 commit 6f8356c
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions git-repository/src/create.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ pub fn into(
let bare = matches!(kind, Kind::Bare);

if bare || destination_must_be_empty {
if fs::read_dir(&dot_git)
let num_entries_in_dot_git = fs::read_dir(&dot_git)
.or_else(|err| {
if err.kind() == std::io::ErrorKind::NotFound {
fs::create_dir(&dot_git).and_then(|_| fs::read_dir(&dot_git))
Expand All @@ -147,9 +147,8 @@ pub fn into(
source: err,
path: dot_git.clone(),
})?
.count()
!= 0
{
.count();
if num_entries_in_dot_git != 0 {
return Err(Error::DirectoryNotEmpty { path: dot_git });
}
}
Expand Down

0 comments on commit 6f8356c

Please sign in to comment.