()
| 561 | |
| 562 | #[test] |
| 563 | fn zeroize_only_drop() { |
| 564 | test_derive( |
| 565 | derive_zeroize_on_drop_impl, |
| 566 | quote! { |
| 567 | struct Z { |
| 568 | a: String, |
| 569 | b: Vec<u8>, |
| 570 | c: [u8; 3], |
| 571 | } |
| 572 | }, |
| 573 | quote! { |
| 574 | impl Drop for Z { |
| 575 | fn drop(&mut self) { |
| 576 | use ::zeroize::__internal::AssertZeroize; |
| 577 | use ::zeroize::__internal::AssertZeroizeOnDrop; |
| 578 | match self { |
| 579 | #[allow(unused_variables, unused_assignments)] |
| 580 | Z { a, b, c } => { |
| 581 | a.zeroize_or_on_drop(); |
| 582 | b.zeroize_or_on_drop(); |
| 583 | c.zeroize_or_on_drop() |
| 584 | } |
| 585 | _ => {} |
| 586 | } |
| 587 | } |
| 588 | } |
| 589 | #[doc(hidden)] |
| 590 | impl ::zeroize::ZeroizeOnDrop for Z {} |
| 591 | }, |
| 592 | ); |
| 593 | } |
| 594 | |
| 595 | #[test] |
| 596 | fn zeroize_on_struct() { |
nothing calls this directly
no test coverage detected