Skip to content

Commit 6d67530

Browse files
committed
fs/tests: Fail fast on duplicate errors rather than looping indefinitely
1 parent 5e38c33 commit 6d67530

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

std/src/fs/tests.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1592,6 +1592,6 @@ fn test_read_dir_infinite_loop() {
15921592
// Skip the test if we can't open the directory in the first place
15931593
let Ok(dir) = fs::read_dir(path) else { return };
15941594

1595-
// Iterate through the directory
1596-
for _ in dir {}
1595+
// Check for duplicate errors
1596+
assert!(dir.filter(|e| e.is_err()).take(2).count() < 2);
15971597
}

0 commit comments

Comments
 (0)