Skip to content

Commit c8dd241

Browse files
authored
doubly-linked-list: improve leak check (#2043)
Previously the check may fail due to an underflow in the subtraction, rather than the assert.
1 parent e522e6b commit c8dd241

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

exercises/practice/doubly-linked-list/tests/step_4_leak_test_2.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@ fn drop_no_leaks() {
1919
drop(list);
2020

2121
let allocated_after = ALLOCATED.load(SeqCst);
22-
let leaked_bytes = allocated_before - allocated_after;
23-
assert!(leaked_bytes == 0);
22+
assert_eq!(allocated_before, allocated_after);
2423
}
2524

2625
// Defines a wrapper around the global allocator that counts allocations

0 commit comments

Comments
 (0)