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
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
// ignore-tidy-linelength

#![feature(doc_cfg)]
#![feature(doc_auto_cfg)]

pub mod another_folder;
pub mod another_mod;

pub mod module {
    pub mod sub_module {
        pub mod sub_sub_module {
            pub fn foo() {}
        }
        pub fn bar() {}
    }
    pub fn whatever() {}
}

pub fn foobar() {}

pub type Alias = u32;

#[doc(cfg(feature = "foo-method"))]
pub struct Foo {
    pub x: Alias,
}

impl Foo {
    /// Some documentation
    /// # A Heading
    pub fn a_method(&self) {}

    #[cfg(all(
        feature = "Win32",
        feature = "Win32_System",
        feature = "Win32_System_Diagnostics",
        feature = "Win32_System_Diagnostics_Debug"
    ))]
    pub fn lot_of_features() {}
}

#[doc(cfg(feature = "foo-method"))]
#[deprecated = "Whatever [`Foo::a_method`](#method.a_method)"]
pub trait Trait {
    type X;
    const Y: u32;

    #[deprecated = "Whatever [`Foo`](#tadam)"]
    fn foo() {}
    fn fooo();
}

impl Trait for Foo {
    type X = u32;
    const Y: u32 = 0;

    fn fooo() {}
}

impl implementors::Whatever for Foo {
    type Foo = u32;
}

#[doc(inline)]
pub use implementors::TraitToReexport;

pub struct StructToImplOnReexport;

impl TraitToReexport for StructToImplOnReexport {}

pub mod sub_mod {
    /// ```txt
    /// aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
    /// ```
    ///
    /// ```
    /// aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
    /// ```
    pub struct Foo;
}

pub mod long_trait {
    use std::ops::DerefMut;

    pub trait ALongNameBecauseItHelpsTestingTheCurrentProblem:
        DerefMut<Target = u32> + From<u128> + Send + Sync + AsRef<str> + 'static
    {
    }
}

pub mod long_table {
    /// | This::is::a::kinda::very::long::header::number::one | This::is::a::kinda::very::long::header::number::two | This::is::a::kinda::very::long::header::number::one | This::is::a::kinda::very::long::header::number::two |
    /// | ----------- | ----------- | ----------- | ----------- |
    /// | This::is::a::kinda::long::content::number::one | This::is::a::kinda::very::long::content::number::two | This::is::a::kinda::long::content::number::one | This::is::a::kinda::very::long::content::number::two |
    ///
    /// I wanna sqdkfnqds f dsqf qds f dsqf dsq f dsq f qds f qds f qds f dsqq f dsf sqdf dsq fds f dsq f dq f ds fq sd fqds f dsq f sqd fsq df sd fdsqfqsd fdsq f dsq f dsqfd s dfq
    pub struct Foo;

    /// | This::is::a::kinda::very::long::header::number::one | This::is::a::kinda::very::long::header::number::two | This::is::a::kinda::very::long::header::number::one | This::is::a::kinda::very::long::header::number::two |
    /// | ----------- | ----------- | ----------- | ----------- |
    /// | This::is::a::kinda::long::content::number::one | This::is::a::kinda::very::long::content::number::two | This::is::a::kinda::long::content::number::one | This::is::a::kinda::very::long::content::number::two |
    ///
    /// I wanna sqdkfnqds f dsqf qds f dsqf dsq f dsq f qds f qds f qds f dsqq f dsf sqdf dsq fds f dsq f dq f ds fq sd fqds f dsq f sqd fsq df sd fdsqfqsd fdsq f dsq f dsqfd s dfq
    impl Foo {
        pub fn foo(&self) {}
    }
}

pub mod summary_table {
    /// | header 1 | header 2 |
    /// | -------- | -------- |
    /// | content | content |
    pub struct Foo;
}

pub mod too_long {
    pub type ReallyLongTypeNameLongLongLong =
        Option<unsafe extern "C" fn(a: *const u8, b: *const u8) -> *const u8>;

    /// Short doc.
    pub const ReallyLongTypeNameLongLongLongConstBecauseWhyNotAConstRightGigaGigaSupraLong: u32 = 0;

    /// This also has a really long doccomment. Lorem ipsum dolor sit amet,
    /// consectetur adipiscing elit. Suspendisse id nibh malesuada, hendrerit
    /// massa vel, tincidunt est. Nulla interdum, sem ac efficitur ornare, arcu
    /// nunc dignissim nibh, at rutrum diam augue ac mauris. Fusce tincidunt et
    /// ligula sed viverra. Aenean sed facilisis dui, non volutpat felis. In
    /// vitae est dui. Donec felis nibh, blandit at nibh eu, tempor suscipit
    /// nisl. Vestibulum ornare porta libero, eu faucibus purus iaculis ut. Ut
    /// quis tincidunt nunc, in mollis purus. Nulla sed interdum quam. Nunc
    /// vitae cursus ex.
    pub struct SuperIncrediblyLongLongLongLongLongLongLongGigaGigaGigaMegaLongLongLongStructName {
        pub a: u32,
    }

    impl SuperIncrediblyLongLongLongLongLongLongLongGigaGigaGigaMegaLongLongLongStructName {
        /// ```
        /// let x = SuperIncrediblyLongLongLongLongLongLongLongGigaGigaGigaMegaLongLongLongStructName { a: 0 };
        /// ```
        pub fn foo(&self) {}
    }
}

pub struct HasALongTraitWithParams {}

pub trait LongTraitWithParamsBananaBananaBanana<T> {}

impl LongTraitWithParamsBananaBananaBanana<usize> for HasALongTraitWithParams {}

#[doc(cfg(any(target_os = "android", target_os = "linux", target_os = "emscripten", target_os = "dragonfly", target_os = "freebsd", target_os = "netbsd", target_os = "openbsd")))]
pub struct LongItemInfo;

pub trait SimpleTrait {}
pub struct LongItemInfo2;

/// Some docs.
#[doc(cfg(any(target_os = "android", target_os = "linux", target_os = "emscripten", target_os = "dragonfly", target_os = "freebsd", target_os = "netbsd", target_os = "openbsd")))]
impl SimpleTrait for LongItemInfo2 {}

pub struct WhereWhitespace<T>(T);

impl<T> WhereWhitespace<T> {
    pub fn new<F>(f: F) -> Self
    where
        F: FnMut() -> i32,
    {todo!()}
}

impl<K, T> Whitespace<&K> for WhereWhitespace<T>
where
    K: std::fmt::Debug,
{
    type Output = WhereWhitespace<T>;
    fn index(&self, _key: &K) -> &Self::Output {
        self
    }
}

pub trait Whitespace<Idx>
where
    Idx: ?Sized,
{
    type Output;
    fn index(&self, index: Idx) -> &Self::Output;
}

pub struct ItemInfoAlignmentTest;

impl ItemInfoAlignmentTest {
    /// This method has docs
    #[deprecated]
    pub fn foo() {}
    #[deprecated]
    pub fn bar() {}
}

pub mod scroll_traits {
    use std::iter::*;

    struct Intersperse<T>(T);
    struct IntersperseWith<T, U>(T, U);
    struct Flatten<T>(T);
    struct Peekable<T>(T);

    /// Shamelessly (partially) copied from `std::iter::Iterator`.
    /// It allows us to check that the scroll is working as expected on "hidden" items.
    pub trait Iterator {
        type Item;

        fn next(&mut self) -> Option<Self::Item>;
        fn size_hint(&self) -> (usize, Option<usize>);
        fn count(self) -> usize
        where
            Self: Sized;
        fn last(self) -> Option<Self::Item>
        where
            Self: Sized;
        fn advance_by(&mut self, n: usize) -> Result<(), usize>;
        fn nth(&mut self, n: usize) -> Option<Self::Item>;
        fn step_by(self, step: usize) -> StepBy<Self>
        where
            Self: Sized;
        fn chain<U>(self, other: U) -> Chain<Self, U::IntoIter>
        where
            Self: Sized,
            U: IntoIterator<Item = Self::Item>;
        fn zip<U>(self, other: U) -> Zip<Self, U::IntoIter>
        where
            Self: Sized,
            U: IntoIterator;
        fn intersperse(self, separator: Self::Item) -> Intersperse<Self>
        where
            Self: Sized,
            Self::Item: Clone;
        fn intersperse_with<G>(self, separator: G) -> IntersperseWith<Self, G>
        where
            Self: Sized,
            G: FnMut() -> Self::Item;
        fn map<B, F>(self, f: F) -> Map<Self, F>
        where
            Self: Sized,
            F: FnMut(Self::Item) -> B;
        fn for_each<F>(self, f: F)
        where
            Self: Sized,
            F: FnMut(Self::Item);
        fn filter<P>(self, predicate: P) -> Filter<Self, P>
        where
            Self: Sized,
            P: FnMut(&Self::Item) -> bool;
        fn filter_map<B, F>(self, f: F) -> FilterMap<Self, F>
        where
            Self: Sized,
            F: FnMut(Self::Item) -> Option<B>;
        fn enumerate(self) -> Enumerate<Self>
        where
            Self: Sized;
        fn peekable(self) -> Peekable<Self>
        where
            Self: Sized;
        fn skip_while<P>(self, predicate: P) -> SkipWhile<Self, P>
        where
            Self: Sized,
            P: FnMut(&Self::Item) -> bool;
        fn take_while<P>(self, predicate: P) -> TakeWhile<Self, P>
        where
            Self: Sized,
            P: FnMut(&Self::Item) -> bool;
        fn map_while<B, P>(self, predicate: P) -> MapWhile<Self, P>
        where
            Self: Sized,
            P: FnMut(Self::Item) -> Option<B>;
        fn skip(self, n: usize) -> Skip<Self>
        where
            Self: Sized;
        fn take(self, n: usize) -> Take<Self>
        where
            Self: Sized;
        fn scan<St, B, F>(self, initial_state: St, f: F) -> Scan<Self, St, F>
        where
            Self: Sized,
            F: FnMut(&mut St, Self::Item) -> Option<B>;
        fn flat_map<U, F>(self, f: F) -> FlatMap<Self, U, F>
        where
            Self: Sized,
            U: IntoIterator,
            F: FnMut(Self::Item) -> U;
        fn flatten(self) -> Flatten<Self>
        where
            Self: Sized,
            Self::Item: IntoIterator;
        fn fuse(self) -> Fuse<Self>
        where
            Self: Sized;
        fn inspect<F>(self, f: F) -> Inspect<Self, F>
        where
            Self: Sized,
            F: FnMut(&Self::Item);
        fn by_ref(&mut self) -> &mut Self
        where
            Self: Sized;
        fn collect<B: FromIterator<Self::Item>>(self) -> B
        where
            Self: Sized;
        fn collect_into<E: Extend<Self::Item>>(self, collection: &mut E) -> &mut E
        where
            Self: Sized;
        fn partition<B, F>(self, f: F) -> (B, B)
        where
            Self: Sized,
            B: Default + Extend<Self::Item>,
            F: FnMut(&Self::Item) -> bool;
        fn partition_in_place<'a, T: 'a, P>(mut self, predicate: P) -> usize
        where
            Self: Sized + DoubleEndedIterator<Item = &'a mut T>,
            P: FnMut(&T) -> bool;
        fn is_partitioned<P>(mut self, mut predicate: P) -> bool
        where
            Self: Sized,
            P: FnMut(Self::Item) -> bool;
        fn fold<B, F>(mut self, init: B, mut f: F) -> B
        where
            Self: Sized,
            F: FnMut(B, Self::Item) -> B;
        fn reduce<F>(mut self, f: F) -> Option<Self::Item>
        where
            Self: Sized,
            F: FnMut(Self::Item, Self::Item) -> Self::Item;
        fn all<F>(&mut self, f: F) -> bool
        where
            Self: Sized,
            F: FnMut(Self::Item) -> bool;
        fn any<F>(&mut self, f: F) -> bool
        where
            Self: Sized,
            F: FnMut(Self::Item) -> bool;
        fn find<P>(&mut self, predicate: P) -> Option<Self::Item>
        where
            Self: Sized,
            P: FnMut(&Self::Item) -> bool;
        fn find_map<B, F>(&mut self, f: F) -> Option<B>
        where
            Self: Sized,
            F: FnMut(Self::Item) -> Option<B>;
        fn position<P>(&mut self, predicate: P) -> Option<usize>
        where
            Self: Sized,
            P: FnMut(Self::Item) -> bool;
        /// We will scroll to "string" to ensure it scrolls as expected.
        fn this_is_a_method_with_a_long_name_returning_something() -> String;
    }

    /// This one doesn't have hidden items (because there are too many) so we can also confirm that it
    /// scrolls as expected.
    pub trait TraitWithLongItemsName {
        fn this_is_a_method_with_a_long_name_returning_something() -> String;
    }
}

pub struct Derefer(String);

impl std::ops::Deref for Derefer {
    type Target = str;

    fn deref(&self) -> &Self::Target {
        &self.0
    }
}