Skip to content

Commit 8fc500f

Browse files
Improves file extension check in cleanup
Refactors the file extension check during test environment cleanup to use `is_some_and` for improved readability and conciseness. This change makes the condition more explicit and easier to understand by directly checking if an extension exists and if it matches the expected value.
1 parent 1c089df commit 8fc500f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

tests/integration_tests.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ impl TestEnvironment {
5757
// Also clean up any leftover config files
5858
if let Ok(entries) = fs::read_dir(&self.config_dir) {
5959
for entry in entries.flatten() {
60-
if entry.path().extension().map_or(false, |ext| ext == "json") {
60+
if entry.path().extension().is_some_and(|ext| ext == "json") {
6161
let _ = fs::remove_file(entry.path());
6262
}
6363
}
@@ -66,7 +66,7 @@ impl TestEnvironment {
6666
// Clean up any leftover PID files
6767
if let Ok(entries) = fs::read_dir(&self.config_dir) {
6868
for entry in entries.flatten() {
69-
if entry.path().extension().map_or(false, |ext| ext == "pid") {
69+
if entry.path().extension().is_some_and(|ext| ext == "pid") {
7070
let _ = fs::remove_file(entry.path());
7171
}
7272
}

0 commit comments

Comments
 (0)