Skip to content

Commit ab5de38

Browse files
committed
Auto merge of #5030 - JohnTitor:split-missing-doc, r=phansch
Split up `missing-doc` ui test Part of #2038 changelog: none
2 parents ac795a6 + 77e5a1b commit ab5de38

File tree

4 files changed

+214
-202
lines changed

4 files changed

+214
-202
lines changed

tests/ui/missing-doc-impl.rs

+87
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
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 {
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 foo() {}
63+
fn bar() {}
64+
}
65+
66+
impl PubFoo {
67+
pub fn foo() {}
68+
/// dox
69+
pub fn foo1() {}
70+
fn foo2() {}
71+
#[allow(clippy::missing_docs_in_private_items)]
72+
pub fn foo3() {}
73+
}
74+
75+
#[allow(clippy::missing_docs_in_private_items)]
76+
trait F {
77+
fn a();
78+
fn b(&self);
79+
}
80+
81+
// should need to redefine documentation for implementations of traits
82+
impl F for Foo {
83+
fn a() {}
84+
fn b(&self) {}
85+
}
86+
87+
fn main() {}

tests/ui/missing-doc-impl.stderr

+103
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
error: missing documentation for a struct
2+
--> $DIR/missing-doc-impl.rs:8:1
3+
|
4+
LL | / struct Foo {
5+
LL | | a: isize,
6+
LL | | b: isize,
7+
LL | | }
8+
| |_^
9+
|
10+
= note: `-D clippy::missing-docs-in-private-items` implied by `-D warnings`
11+
12+
error: missing documentation for a struct field
13+
--> $DIR/missing-doc-impl.rs:9:5
14+
|
15+
LL | a: isize,
16+
| ^^^^^^^^
17+
18+
error: missing documentation for a struct field
19+
--> $DIR/missing-doc-impl.rs:10:5
20+
|
21+
LL | b: isize,
22+
| ^^^^^^^^
23+
24+
error: missing documentation for a struct
25+
--> $DIR/missing-doc-impl.rs:13:1
26+
|
27+
LL | / pub struct PubFoo {
28+
LL | | pub a: isize,
29+
LL | | b: isize,
30+
LL | | }
31+
| |_^
32+
33+
error: missing documentation for a struct field
34+
--> $DIR/missing-doc-impl.rs:14:5
35+
|
36+
LL | pub a: isize,
37+
| ^^^^^^^^^^^^
38+
39+
error: missing documentation for a struct field
40+
--> $DIR/missing-doc-impl.rs:15:5
41+
|
42+
LL | b: isize,
43+
| ^^^^^^^^
44+
45+
error: missing documentation for a trait
46+
--> $DIR/missing-doc-impl.rs:38:1
47+
|
48+
LL | / pub trait C {
49+
LL | | fn foo(&self);
50+
LL | | fn foo_with_impl(&self) {}
51+
LL | | }
52+
| |_^
53+
54+
error: missing documentation for a trait method
55+
--> $DIR/missing-doc-impl.rs:39:5
56+
|
57+
LL | fn foo(&self);
58+
| ^^^^^^^^^^^^^^
59+
60+
error: missing documentation for a trait method
61+
--> $DIR/missing-doc-impl.rs:40:5
62+
|
63+
LL | fn foo_with_impl(&self) {}
64+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
65+
66+
error: missing documentation for an associated type
67+
--> $DIR/missing-doc-impl.rs:50:5
68+
|
69+
LL | type AssociatedType;
70+
| ^^^^^^^^^^^^^^^^^^^^
71+
72+
error: missing documentation for an associated type
73+
--> $DIR/missing-doc-impl.rs:51:5
74+
|
75+
LL | type AssociatedTypeDef = Self;
76+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
77+
78+
error: missing documentation for a method
79+
--> $DIR/missing-doc-impl.rs:62:5
80+
|
81+
LL | pub fn foo() {}
82+
| ^^^^^^^^^^^^^^^
83+
84+
error: missing documentation for a method
85+
--> $DIR/missing-doc-impl.rs:63:5
86+
|
87+
LL | fn bar() {}
88+
| ^^^^^^^^^^^
89+
90+
error: missing documentation for a method
91+
--> $DIR/missing-doc-impl.rs:67:5
92+
|
93+
LL | pub fn foo() {}
94+
| ^^^^^^^^^^^^^^^
95+
96+
error: missing documentation for a method
97+
--> $DIR/missing-doc-impl.rs:70:5
98+
|
99+
LL | fn foo2() {}
100+
| ^^^^^^^^^^^^
101+
102+
error: aborting due to 15 previous errors
103+

tests/ui/missing-doc.rs

+1-80
Original file line numberDiff line numberDiff line change
@@ -2,30 +2,14 @@
22
// When denying at the crate level, be sure to not get random warnings from the
33
// injected intrinsics by the compiler.
44
#![allow(dead_code)]
5-
#![feature(associated_type_defaults, global_asm)]
5+
#![feature(global_asm)]
66

77
//! Some garbage docs for the crate here
88
#![doc = "More garbage"]
99

1010
type Typedef = String;
1111
pub type PubTypedef = String;
1212

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-
2913
mod module_no_dox {}
3014
pub mod pub_module_no_dox {}
3115

@@ -36,69 +20,6 @@ fn foo3() {}
3620
#[allow(clippy::missing_docs_in_private_items)]
3721
pub fn foo4() {}
3822

39-
/// dox
40-
pub trait A {
41-
/// dox
42-
fn foo(&self);
43-
/// dox
44-
fn foo_with_impl(&self) {}
45-
}
46-
47-
#[allow(clippy::missing_docs_in_private_items)]
48-
trait B {
49-
fn foo(&self);
50-
fn foo_with_impl(&self) {}
51-
}
52-
53-
pub trait C {
54-
fn foo(&self);
55-
fn foo_with_impl(&self) {}
56-
}
57-
58-
#[allow(clippy::missing_docs_in_private_items)]
59-
pub trait D {
60-
fn dummy(&self) {}
61-
}
62-
63-
/// dox
64-
pub trait E {
65-
type AssociatedType;
66-
type AssociatedTypeDef = Self;
67-
68-
/// dox
69-
type DocumentedType;
70-
/// dox
71-
type DocumentedTypeDef = Self;
72-
/// dox
73-
fn dummy(&self) {}
74-
}
75-
76-
impl Foo {
77-
pub fn foo() {}
78-
fn bar() {}
79-
}
80-
81-
impl PubFoo {
82-
pub fn foo() {}
83-
/// dox
84-
pub fn foo1() {}
85-
fn foo2() {}
86-
#[allow(clippy::missing_docs_in_private_items)]
87-
pub fn foo3() {}
88-
}
89-
90-
#[allow(clippy::missing_docs_in_private_items)]
91-
trait F {
92-
fn a();
93-
fn b(&self);
94-
}
95-
96-
// should need to redefine documentation for implementations of traits
97-
impl F for Foo {
98-
fn a() {}
99-
fn b(&self) {}
100-
}
101-
10223
// It sure is nice if doc(hidden) implies allow(missing_docs), and that it
10324
// applies recursively
10425
#[doc(hidden)]

0 commit comments

Comments
 (0)