From 787cb3a87294cd1f03945f0dd481cb32b09cef63 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Sun, 17 Aug 2025 14:45:08 +0200 Subject: [PATCH] Collapse nested if Signed-off-by: Matthias Beyer --- crates/radicle-cli/src/commands/clone.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/crates/radicle-cli/src/commands/clone.rs b/crates/radicle-cli/src/commands/clone.rs index f34bb0bd..771df420 100644 --- a/crates/radicle-cli/src/commands/clone.rs +++ b/crates/radicle-cli/src/commands/clone.rs @@ -246,10 +246,8 @@ impl Checkout { .map_err(|err| CheckoutFailure::Payload { rid, err })?; let path = directory.unwrap_or_else(|| PathBuf::from(proj.name())); // N.b. fail if the path exists and is not empty - if path.exists() { - if path.read_dir().map_or(true, |mut dir| dir.next().is_some()) { - return Err(CheckoutFailure::Exists { rid, path }); - } + if path.exists() && path.read_dir().map_or(true, |mut dir| dir.next().is_some()) { + return Err(CheckoutFailure::Exists { rid, path }); } Ok(Self {