1 #![feature(box_syntax, fn_traits, unboxed_closures)]
2 #![warn(clippy::no_effect_underscore_binding)]
4 #![allow(path_statements)]
5 #![allow(clippy::deref_addrof)]
6 #![allow(clippy::redundant_field_names)]
7 #![feature(untagged_unions)]
16 Struct { field: i32 },
19 impl Drop for DropUnit {
25 impl Drop for DropStruct {
28 struct DropTuple(i32);
29 impl Drop for DropTuple {
34 Struct { field: i32 },
36 impl Drop for DropEnum {
47 fn get_number() -> i32 {
50 fn get_struct() -> Struct {
53 fn get_drop_struct() -> DropStruct {
54 DropStruct { field: 0 }
57 unsafe fn unsafe_fn() -> i32 {
63 impl FnOnce<(&str,)> for GreetStruct1 {
66 extern "rust-call" fn call_once(self, (who,): (&str,)) -> Self::Output {
67 println!("hello {}", who);
71 struct GreetStruct2();
73 impl FnOnce<(&str,)> for GreetStruct2 {
76 extern "rust-call" fn call_once(self, (who,): (&str,)) -> Self::Output {
77 println!("hello {}", who);
81 struct GreetStruct3 {}
83 impl FnOnce<(&str,)> for GreetStruct3 {
86 extern "rust-call" fn call_once(self, (who,): (&str,)) -> Self::Output {
87 println!("hello {}", who);
93 let s2 = get_struct();
103 Enum::Struct { field: 0 };
121 let s: String = "foo".into();
124 let _penguin = || println!("Some helpful closure");
125 let _duck = Struct { field: 0 };
126 let _cat = [2, 4, 6, 8][2];
128 #[allow(clippy::no_effect)]
133 unsafe { unsafe_fn() };
134 let _used = get_struct();
137 DropStruct { field: 0 };
140 DropEnum::Struct { field: 0 };
141 GreetStruct1("world");
142 GreetStruct2()("world");
143 GreetStruct3 {}("world");