Skip to content

Commit 79f439e

Browse files
committed
fix: resolve clippy collapsible-if warnings in expand_path function
1 parent 9c1212b commit 79f439e

1 file changed

Lines changed: 9 additions & 10 deletions

File tree

src/commands/interactive.rs

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -753,16 +753,15 @@ impl InteractiveCommand {
753753

754754
/// Expand ~ in path to home directory
755755
fn expand_path(&self, path: &std::path::Path) -> Result<PathBuf> {
756-
if let Some(path_str) = path.to_str() {
757-
if path_str.starts_with('~') {
758-
if let Some(home) = dirs::home_dir() {
759-
// Handle ~ alone or ~/path
760-
if path_str == "~" {
761-
return Ok(home);
762-
} else if let Some(rest) = path_str.strip_prefix("~/") {
763-
return Ok(home.join(rest));
764-
}
765-
}
756+
if let Some(path_str) = path.to_str()
757+
&& path_str.starts_with('~')
758+
&& let Some(home) = dirs::home_dir()
759+
{
760+
// Handle ~ alone or ~/path
761+
if path_str == "~" {
762+
return Ok(home);
763+
} else if let Some(rest) = path_str.strip_prefix("~/") {
764+
return Ok(home.join(rest));
766765
}
767766
}
768767
Ok(path.to_path_buf())

0 commit comments

Comments
 (0)