]> git.lizzy.rs Git - rust.git/blob - tests/target/impls.rs
Move Indent and Shape to shape.rs from lib.rs
[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
82 mod b {
83     mod a {
84         impl Foo {
85             fn foo() {}
86         }
87     }
88 }
89
90 impl Foo {
91     add_fun!();
92 }
93
94 impl Blah {
95     fn boop() {}
96     add_fun!();
97 }
98
99 impl X {
100     fn do_parse(mut self: X) {}
101 }
102
103 impl Y5000 {
104     fn bar(self: X<'a, 'b>, y: Y) {}
105
106     fn bad(&self, (x, y): CoorT) {}
107
108     fn turbo_bad(self: X<'a, 'b>, (x, y): CoorT) {}
109 }
110
111 pub impl<T> Foo for Bar<T>
112 where
113     T: Foo,
114 {
115     fn foo() {
116         "hi"
117     }
118 }
119
120 pub impl<T, Z> Foo for Bar<T, Z>
121 where
122     T: Foo,
123     Z: Baz,
124 {
125 }
126
127 mod m {
128     impl<T> PartialEq for S<T>
129     where
130         T: PartialEq,
131     {
132         fn eq(&self, other: &Self) {
133             true
134         }
135     }
136
137     impl<T> PartialEq for S<T>
138     where
139         T: PartialEq,
140     {
141     }
142 }
143
144 impl<BorrowType, K, V, NodeType, HandleType>
145     Handle<NodeRef<BorrowType, K, V, NodeType>, HandleType> {
146 }
147
148 impl<BorrowType, K, V, NodeType, HandleType> PartialEq
149     for Handle<NodeRef<BorrowType, K, V, NodeType>, HandleType> {
150 }
151
152 mod x {
153     impl<A, B, C, D> Foo
154     where
155         A: 'static,
156         B: 'static,
157         C: 'static,
158         D: 'static,
159     {
160     }
161 }
162
163 impl<ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNodeFoo>
164     Issue1249<ConcreteThreadSafeLayoutNode> {
165     // Creates a new flow constructor.
166     fn foo() {}
167 }
168
169 // #1600
170 impl<#[may_dangle] K, #[may_dangle] V> Drop for RawTable<K, V> {
171     fn drop() {}
172 }
173
174 // #1168
175 pub trait Number
176     : Copy
177     + Eq
178     + Not<Output = Self>
179     + Shl<u8, Output = Self>
180     + Shr<u8, Output = Self>
181     + BitAnd<Self, Output = Self>
182     + BitOr<Self, Output = Self>
183     + BitAndAssign
184     + BitOrAssign {
185     // test
186     fn zero() -> Self;
187 }
188
189 // #1642
190 pub trait SomeTrait
191     : Clone
192     + Eq
193     + PartialEq
194     + Ord
195     + PartialOrd
196     + Default
197     + Hash
198     + Debug
199     + Display
200     + Write
201     + Read
202     + FromStr {
203     // comment
204 }