]> git.lizzy.rs Git - rust.git/blob - tests/target/impls.rs
Fix up tests for empty impls
[rust.git] / tests / target / impls.rs
1 // rustfmt-normalize_comments: true
2 impl Foo for Bar {
3     fn foo() {
4         "hi"
5     }
6 }
7
8 pub impl Foo for Bar {
9     // Associated Constants
10     const Baz: i32 = 16;
11     // Associated Types
12     type FooBar = usize;
13     // Comment 1
14     fn foo() {
15         "hi"
16     }
17     // Comment 2
18     fn foo() {
19         "hi"
20     }
21     // Comment 3
22 }
23
24 pub unsafe impl<'a, 'b, X, Y: Foo<Bar>> !Foo<'a, X> for Bar<'b, Y>
25 where
26     X: Foo<'a, Z>,
27 {
28     fn foo() {
29         "hi"
30     }
31 }
32
33 impl<'a, 'b, X, Y: Foo<Bar>> Foo<'a, X> for Bar<'b, Y>
34 where
35     X: Fooooooooooooooooooooooooooooo<'a, Z>,
36 {
37     fn foo() {
38         "hi"
39     }
40 }
41
42 impl<'a, 'b, X, Y: Foo<Bar>> Foo<'a, X> for Bar<'b, Y>
43 where
44     X: Foooooooooooooooooooooooooooo<'a, Z>,
45 {
46     fn foo() {
47         "hi"
48     }
49 }
50
51 impl<T> Foo for Bar<T> where T: Baz {}
52
53 impl<T> Foo for Bar<T>
54 where
55     T: Baz,
56 {
57     // Comment
58 }
59
60 impl Foo {
61     fn foo() {}
62 }
63
64 impl Boo {
65     // BOO
66     fn boo() {}
67     // FOO
68 }
69
70 mod a {
71     impl Foo {
72         // Hello!
73         fn foo() {}
74     }
75 }
76
77 mod b {
78     mod a {
79         impl Foo {
80             fn foo() {}
81         }
82     }
83 }
84
85 impl Foo {
86     add_fun!();
87 }
88
89 impl Blah {
90     fn boop() {}
91     add_fun!();
92 }
93
94 impl X {
95     fn do_parse(mut self: X) {}
96 }
97
98 impl Y5000 {
99     fn bar(self: X<'a, 'b>, y: Y) {}
100
101     fn bad(&self, (x, y): CoorT) {}
102
103     fn turbo_bad(self: X<'a, 'b>, (x, y): CoorT) {}
104 }
105
106 pub impl<T> Foo for Bar<T>
107 where
108     T: Foo,
109 {
110     fn foo() {
111         "hi"
112     }
113 }
114
115 pub impl<T, Z> Foo for Bar<T, Z>
116 where
117     T: Foo,
118     Z: Baz,
119 {
120 }
121
122 mod m {
123     impl<T> PartialEq for S<T>
124     where
125         T: PartialEq,
126     {
127         fn eq(&self, other: &Self) {
128             true
129         }
130     }
131
132     impl<T> PartialEq for S<T> where T: PartialEq {}
133 }
134
135 impl<BorrowType, K, V, NodeType, HandleType>
136     Handle<NodeRef<BorrowType, K, V, NodeType>, HandleType>
137 {}
138
139 impl<BorrowType, K, V, NodeType, HandleType> PartialEq
140     for Handle<NodeRef<BorrowType, K, V, NodeType>, HandleType>
141 {}
142
143 mod x {
144     impl<A, B, C, D> Foo
145     where
146         A: 'static,
147         B: 'static,
148         C: 'static,
149         D: 'static,
150     {}
151 }
152
153 impl<ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNodeFoo>
154     Issue1249<ConcreteThreadSafeLayoutNode>
155 {
156     // Creates a new flow constructor.
157     fn foo() {}
158 }
159
160 // #1600
161 impl<#[may_dangle] K, #[may_dangle] V> Drop for RawTable<K, V> {
162     fn drop() {}
163 }
164
165 // #1168
166 pub trait Number:
167     Copy
168     + Eq
169     + Not<Output = Self>
170     + Shl<u8, Output = Self>
171     + Shr<u8, Output = Self>
172     + BitAnd<Self, Output = Self>
173     + BitOr<Self, Output = Self>
174     + BitAndAssign
175     + BitOrAssign
176 {
177     // test
178     fn zero() -> Self;
179 }
180
181 // #1642
182 pub trait SomeTrait:
183     Clone
184     + Eq
185     + PartialEq
186     + Ord
187     + PartialOrd
188     + Default
189     + Hash
190     + Debug
191     + Display
192     + Write
193     + Read
194     + FromStr
195 {
196     // comment
197 }
198
199 // #1995
200 impl Foo {
201     fn f(
202         S {
203             aaaaaaaaaa: aaaaaaaaaa,
204             bbbbbbbbbb: bbbbbbbbbb,
205             cccccccccc: cccccccccc,
206         }: S,
207     ) -> u32 {
208         1
209     }
210 }
211
212 // #2491
213 impl<'a, 'b, 'c> SomeThing<Something>
214     for (
215         &'a mut SomethingLong,
216         &'b mut SomethingLong,
217         &'c mut SomethingLong,
218     )
219 {
220     fn foo() {}
221 }
222
223 // #2746
224 impl<'seq1, 'seq2, 'body, 'scope, Channel>
225     Adc12<
226         Dual,
227         MasterRunningDma<'seq1, 'body, 'scope, Channel>,
228         SlaveRunningDma<'seq2, 'body, 'scope>,
229     >
230 where
231     Channel: DmaChannel,
232 {}