1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
|
#[macro_use]
extern crate derive_destructure2;
// This is perhaps rather pointless, as you can just use std::mem::forget instead...
// Oh well.
#[derive(destructure, remove_trait_impls)]
struct Foo;
impl Drop for Foo {
fn drop(&mut self) {
panic!("We don't want to drop this");
}
}
#[derive(destructure, remove_trait_impls)]
struct Bar();
impl Drop for Bar {
fn drop(&mut self) {
panic!("We don't want to drop this");
}
}
#[derive(destructure, remove_trait_impls)]
struct Baz {}
impl Drop for Baz {
fn drop(&mut self) {
panic!("We don't want to drop this");
}
}
#[test]
fn test_foo_destructure() {
let x = Foo;
let () = x.destructure();
}
#[test]
fn test_foo_remove_trait_impls() {
let x = Foo;
let _ = x.remove_trait_impls();
}
#[test]
fn test_bar_destructure() {
let x = Bar();
let () = x.destructure();
}
#[test]
fn test_bar_remove_trait_impls() {
let x = Bar();
let _ = x.remove_trait_impls();
}
#[test]
fn test_baz_destructure() {
let x = Baz {};
let () = x.destructure();
}
#[test]
fn test_baz_remove_trait_impls() {
let x = Baz {};
let _ = x.remove_trait_impls();
}
|