]> git.lizzy.rs Git - rust.git/blob - tests/ui/missing-doc-impl.rs
Don't lint `if_same_then_else` with `if let` conditions
[rust.git] / tests / ui / missing-doc-impl.rs
1 #![warn(clippy::missing_docs_in_private_items)]
2 #![allow(dead_code)]
3 #![feature(associated_type_defaults)]
4
5 //! Some garbage docs for the crate here
6 #![doc = "More garbage"]
7
8 struct Foo {
9     a: isize,
10     b: isize,
11 }
12
13 pub struct PubFoo {
14     pub a: isize,
15     b: isize,
16 }
17
18 #[allow(clippy::missing_docs_in_private_items)]
19 pub struct PubFoo2 {
20     pub a: isize,
21     pub c: isize,
22 }
23
24 /// dox
25 pub trait A {
26     /// dox
27     fn foo(&self);
28     /// dox
29     fn foo_with_impl(&self) {}
30 }
31
32 #[allow(clippy::missing_docs_in_private_items)]
33 trait B {
34     fn foo(&self);
35     fn foo_with_impl(&self) {}
36 }
37
38 pub trait C {
39     fn foo(&self);
40     fn foo_with_impl(&self) {}
41 }
42
43 #[allow(clippy::missing_docs_in_private_items)]
44 pub trait D {
45     fn dummy(&self) {}
46 }
47
48 /// dox
49 pub trait E: Sized {
50     type AssociatedType;
51     type AssociatedTypeDef = Self;
52
53     /// dox
54     type DocumentedType;
55     /// dox
56     type DocumentedTypeDef = Self;
57     /// dox
58     fn dummy(&self) {}
59 }
60
61 impl Foo {
62     pub fn new() -> Self {
63         Foo { a: 0, b: 0 }
64     }
65     fn bar() {}
66 }
67
68 impl PubFoo {
69     pub fn foo() {}
70     /// dox
71     pub fn foo1() {}
72     #[must_use = "yep"]
73     fn foo2() -> u32 {
74         1
75     }
76     #[allow(clippy::missing_docs_in_private_items)]
77     pub fn foo3() {}
78 }
79
80 #[allow(clippy::missing_docs_in_private_items)]
81 trait F {
82     fn a();
83     fn b(&self);
84 }
85
86 // should need to redefine documentation for implementations of traits
87 impl F for Foo {
88     fn a() {}
89     fn b(&self) {}
90 }
91
92 fn main() {}