summaryrefslogtreecommitdiffstats
path: root/src/tools/rustfmt/tests/target/impls.rs
blob: 99e02990e417775ba8a9821a501e9ce0d4f0f960 (plain)
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
// rustfmt-normalize_comments: true
impl Foo for Bar {
    fn foo() {
        "hi"
    }
}

pub impl Foo for Bar {
    // Associated Constants
    const Baz: i32 = 16;
    // Associated Types
    type FooBar = usize;
    // Comment 1
    fn foo() {
        "hi"
    }
    // Comment 2
    fn foo() {
        "hi"
    }
    // Comment 3
}

#[inherent]
impl Visible for Bar {
    pub const C: i32;
    pub type T;
    pub fn f();
    pub fn g() {}
}

pub unsafe impl<'a, 'b, X, Y: Foo<Bar>> !Foo<'a, X> for Bar<'b, Y>
where
    X: Foo<'a, Z>,
{
    fn foo() {
        "hi"
    }
}

impl<'a, 'b, X, Y: Foo<Bar>> Foo<'a, X> for Bar<'b, Y>
where
    X: Fooooooooooooooooooooooooooooo<'a, Z>,
{
    fn foo() {
        "hi"
    }
}

impl<'a, 'b, X, Y: Foo<Bar>> Foo<'a, X> for Bar<'b, Y>
where
    X: Foooooooooooooooooooooooooooo<'a, Z>,
{
    fn foo() {
        "hi"
    }
}

impl<T> Foo for Bar<T> where T: Baz {}

impl<T> Foo for Bar<T>
where
    T: Baz,
{
    // Comment
}

impl Foo {
    fn foo() {}
}

impl Boo {
    // BOO
    fn boo() {}
    // FOO
}

mod a {
    impl Foo {
        // Hello!
        fn foo() {}
    }
}

mod b {
    mod a {
        impl Foo {
            fn foo() {}
        }
    }
}

impl Foo {
    add_fun!();
}

impl Blah {
    fn boop() {}
    add_fun!();
}

impl X {
    fn do_parse(mut self: X) {}
}

impl Y5000 {
    fn bar(self: X<'a, 'b>, y: Y) {}

    fn bad(&self, (x, y): CoorT) {}

    fn turbo_bad(self: X<'a, 'b>, (x, y): CoorT) {}
}

pub impl<T> Foo for Bar<T>
where
    T: Foo,
{
    fn foo() {
        "hi"
    }
}

pub impl<T, Z> Foo for Bar<T, Z>
where
    T: Foo,
    Z: Baz,
{
}

mod m {
    impl<T> PartialEq for S<T>
    where
        T: PartialEq,
    {
        fn eq(&self, other: &Self) {
            true
        }
    }

    impl<T> PartialEq for S<T> where T: PartialEq {}
}

impl<BorrowType, K, V, NodeType, HandleType>
    Handle<NodeRef<BorrowType, K, V, NodeType>, HandleType>
{
}

impl<BorrowType, K, V, NodeType, HandleType> PartialEq
    for Handle<NodeRef<BorrowType, K, V, NodeType>, HandleType>
{
}

mod x {
    impl<A, B, C, D> Foo
    where
        A: 'static,
        B: 'static,
        C: 'static,
        D: 'static,
    {
    }
}

impl<ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNodeFoo>
    Issue1249<ConcreteThreadSafeLayoutNode>
{
    // Creates a new flow constructor.
    fn foo() {}
}

// #1600
impl<#[may_dangle] K, #[may_dangle] V> Drop for RawTable<K, V> {
    fn drop() {}
}

// #1168
pub trait Number:
    Copy
    + Eq
    + Not<Output = Self>
    + Shl<u8, Output = Self>
    + Shr<u8, Output = Self>
    + BitAnd<Self, Output = Self>
    + BitOr<Self, Output = Self>
    + BitAndAssign
    + BitOrAssign
{
    // test
    fn zero() -> Self;
}

// #1642
pub trait SomeTrait:
    Clone
    + Eq
    + PartialEq
    + Ord
    + PartialOrd
    + Default
    + Hash
    + Debug
    + Display
    + Write
    + Read
    + FromStr
{
    // comment
}

// #1995
impl Foo {
    fn f(
        S {
            aaaaaaaaaa: aaaaaaaaaa,
            bbbbbbbbbb: bbbbbbbbbb,
            cccccccccc: cccccccccc,
        }: S,
    ) -> u32 {
        1
    }
}

// #2491
impl<'a, 'b, 'c> SomeThing<Something>
    for (
        &'a mut SomethingLong,
        &'b mut SomethingLong,
        &'c mut SomethingLong,
    )
{
    fn foo() {}
}

// #2746
impl<'seq1, 'seq2, 'body, 'scope, Channel>
    Adc12<
        Dual,
        MasterRunningDma<'seq1, 'body, 'scope, Channel>,
        SlaveRunningDma<'seq2, 'body, 'scope>,
    >
where
    Channel: DmaChannel,
{
}

// #4084
impl const std::default::Default for Struct {
    #[inline]
    fn default() -> Self {
        Self { f: 12.5 }
    }
}