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