]> git.proxmox.com Git - rustc.git/blame - src/tools/clippy/tests/ui/missing-doc-impl.rs
New upstream version 1.55.0+dfsg1
[rustc.git] / src / tools / clippy / tests / ui / missing-doc-impl.rs
CommitLineData
f20569fa
XL
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
8struct Foo {
9 a: isize,
10 b: isize,
11}
12
13pub struct PubFoo {
14 pub a: isize,
15 b: isize,
16}
17
18#[allow(clippy::missing_docs_in_private_items)]
19pub struct PubFoo2 {
20 pub a: isize,
21 pub c: isize,
22}
23
24/// dox
25pub 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)]
33trait B {
34 fn foo(&self);
35 fn foo_with_impl(&self) {}
36}
37
38pub trait C {
39 fn foo(&self);
40 fn foo_with_impl(&self) {}
41}
42
43#[allow(clippy::missing_docs_in_private_items)]
44pub trait D {
45 fn dummy(&self) {}
46}
47
48/// dox
49pub 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
61impl Foo {
136023e0
XL
62 pub fn new() -> Self {
63 Foo { a: 0, b: 0 }
64 }
f20569fa
XL
65 fn bar() {}
66}
67
68impl PubFoo {
69 pub fn foo() {}
70 /// dox
71 pub fn foo1() {}
17df50a5
XL
72 #[must_use = "yep"]
73 fn foo2() -> u32 {
74 1
75 }
f20569fa
XL
76 #[allow(clippy::missing_docs_in_private_items)]
77 pub fn foo3() {}
78}
79
80#[allow(clippy::missing_docs_in_private_items)]
81trait F {
82 fn a();
83 fn b(&self);
84}
85
86// should need to redefine documentation for implementations of traits
87impl F for Foo {
88 fn a() {}
89 fn b(&self) {}
90}
91
92fn main() {}