Skip to content

Commit 89b7aa2

Browse files
committed
fix: collapse nested if-let statements per clippy
1 parent 973dae6 commit 89b7aa2

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

src/cortex-tui/src/session/storage.rs

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -120,12 +120,10 @@ impl SessionStorage {
120120

121121
// Sync parent directory on Unix for crash safety (ensures directory entry is persisted)
122122
#[cfg(unix)]
123+
if let Some(parent) = path.parent()
124+
&& let Ok(dir) = File::open(parent)
123125
{
124-
if let Some(parent) = path.parent() {
125-
if let Ok(dir) = File::open(parent) {
126-
let _ = dir.sync_all();
127-
}
128-
}
126+
let _ = dir.sync_all();
129127
}
130128

131129
Ok(())
@@ -241,12 +239,10 @@ impl SessionStorage {
241239

242240
// Sync parent directory on Unix for crash safety (ensures directory entry is persisted)
243241
#[cfg(unix)]
242+
if let Some(parent) = path.parent()
243+
&& let Ok(dir) = File::open(parent)
244244
{
245-
if let Some(parent) = path.parent() {
246-
if let Ok(dir) = File::open(parent) {
247-
let _ = dir.sync_all();
248-
}
249-
}
245+
let _ = dir.sync_all();
250246
}
251247

252248
Ok(())

0 commit comments

Comments
 (0)