]> git.lizzy.rs Git - rust.git/blob - tests/target/impls.rs
Merge pull request #2173 from topecongiro/assignment-with-100-chars
[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>
52 where
53     T: Baz,
54 {
55 }
56
57 impl<T> Foo for Bar<T>
58 where
59     T: Baz,
60 {
61     // Comment
62 }
63
64 impl Foo {
65     fn foo() {}
66 }
67
68 impl Boo {
69     // BOO
70     fn boo() {}
71     // FOO
72 }
73
74 mod a {
75     impl Foo {
76         // Hello!
77         fn foo() {}
78     }
79 }
80
81 mod b {
82     mod a {
83         impl Foo {
84             fn foo() {}
85         }
86     }
87 }
88
89 impl Foo {
90     add_fun!();
91 }
92
93 impl Blah {
94     fn boop() {}
95     add_fun!();
96 }
97
98 impl X {
99     fn do_parse(mut self: X) {}
100 }
101
102 impl Y5000 {
103     fn bar(self: X<'a, 'b>, y: Y) {}
104
105     fn bad(&self, (x, y): CoorT) {}
106
107     fn turbo_bad(self: X<'a, 'b>, (x, y): CoorT) {}
108 }
109
110 pub impl<T> Foo for Bar<T>
111 where
112     T: Foo,
113 {
114     fn foo() {
115         "hi"
116     }
117 }
118
119 pub impl<T, Z> Foo for Bar<T, Z>
120 where
121     T: Foo,
122     Z: Baz,
123 {
124 }
125
126 mod m {
127     impl<T> PartialEq for S<T>
128     where
129         T: PartialEq,
130     {
131         fn eq(&self, other: &Self) {
132             true
133         }
134     }
135
136     impl<T> PartialEq for S<T>
137     where
138         T: PartialEq,
139     {
140     }
141 }
142
143 impl<BorrowType, K, V, NodeType, HandleType>
144     Handle<NodeRef<BorrowType, K, V, NodeType>, HandleType> {
145 }
146
147 impl<BorrowType, K, V, NodeType, HandleType> PartialEq
148     for Handle<NodeRef<BorrowType, K, V, NodeType>, HandleType> {
149 }
150
151 mod x {
152     impl<A, B, C, D> Foo
153     where
154         A: 'static,
155         B: 'static,
156         C: 'static,
157         D: 'static,
158     {
159     }
160 }
161
162 impl<ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNodeFoo>
163     Issue1249<ConcreteThreadSafeLayoutNode> {
164     // Creates a new flow constructor.
165     fn foo() {}
166 }
167
168 // #1600
169 impl<#[may_dangle] K, #[may_dangle] V> Drop for RawTable<K, V> {
170     fn drop() {}
171 }
172
173 // #1168
174 pub trait Number
175     : Copy
176     + Eq
177     + Not<Output = Self>
178     + Shl<u8, Output = Self>
179     + Shr<u8, Output = Self>
180     + BitAnd<Self, Output = Self>
181     + BitOr<Self, Output = Self>
182     + BitAndAssign
183     + BitOrAssign {
184     // test
185     fn zero() -> Self;
186 }
187
188 // #1642
189 pub trait SomeTrait
190     : Clone
191     + Eq
192     + PartialEq
193     + Ord
194     + PartialOrd
195     + Default
196     + Hash
197     + Debug
198     + Display
199     + Write
200     + Read
201     + FromStr {
202     // comment
203 }
204
205 // #1995
206 impl Foo {
207     fn f(
208         S {
209             aaaaaaaaaa: aaaaaaaaaa,
210             bbbbbbbbbb: bbbbbbbbbb,
211             cccccccccc: cccccccccc,
212         }: S,
213     ) -> u32 {
214         1
215     }
216 }