We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 03ef6c9 + cd29966 commit 49cc30dCopy full SHA for 49cc30d
src/histbuf.rs
@@ -676,4 +676,26 @@ mod tests {
676
);
677
}
678
679
+
680
+ #[test]
681
+ fn clear_drops_values() {
682
+ static DROP_COUNT: AtomicUsize = AtomicUsize::new(0);
683
684
+ struct DropCheck {}
685
686
+ impl Drop for DropCheck {
687
+ fn drop(&mut self) {
688
+ DROP_COUNT.fetch_add(1, Ordering::SeqCst);
689
+ }
690
691
692
+ let mut x: HistoryBuffer<DropCheck, 3> = HistoryBuffer::new();
693
+ x.write(DropCheck {});
694
695
696
697
+ assert_eq!(DROP_COUNT.load(Ordering::SeqCst), 0);
698
+ x.clear();
699
+ assert_eq!(DROP_COUNT.load(Ordering::SeqCst), 3);
700
701
0 commit comments