Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Split up missing-doc ui test #5030

Merged
merged 1 commit into from
Jan 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
87 changes: 87 additions & 0 deletions tests/ui/missing-doc-impl.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
#![warn(clippy::missing_docs_in_private_items)]
#![allow(dead_code)]
#![feature(associated_type_defaults)]

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

struct Foo {
a: isize,
b: isize,
}

pub struct PubFoo {
pub a: isize,
b: isize,
}

#[allow(clippy::missing_docs_in_private_items)]
pub struct PubFoo2 {
pub a: isize,
pub c: isize,
}

/// dox
pub trait A {
/// dox
fn foo(&self);
/// dox
fn foo_with_impl(&self) {}
}

#[allow(clippy::missing_docs_in_private_items)]
trait B {
fn foo(&self);
fn foo_with_impl(&self) {}
}

pub trait C {
fn foo(&self);
fn foo_with_impl(&self) {}
}

#[allow(clippy::missing_docs_in_private_items)]
pub trait D {
fn dummy(&self) {}
}

/// dox
pub trait E {
type AssociatedType;
type AssociatedTypeDef = Self;

/// dox
type DocumentedType;
/// dox
type DocumentedTypeDef = Self;
/// dox
fn dummy(&self) {}
}

impl Foo {
pub fn foo() {}
fn bar() {}
}

impl PubFoo {
pub fn foo() {}
/// dox
pub fn foo1() {}
fn foo2() {}
#[allow(clippy::missing_docs_in_private_items)]
pub fn foo3() {}
}

#[allow(clippy::missing_docs_in_private_items)]
trait F {
fn a();
fn b(&self);
}

// should need to redefine documentation for implementations of traits
impl F for Foo {
fn a() {}
fn b(&self) {}
}

fn main() {}
103 changes: 103 additions & 0 deletions tests/ui/missing-doc-impl.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
error: missing documentation for a struct
--> $DIR/missing-doc-impl.rs:8:1
|
LL | / struct Foo {
LL | | a: isize,
LL | | b: isize,
LL | | }
| |_^
|
= note: `-D clippy::missing-docs-in-private-items` implied by `-D warnings`

error: missing documentation for a struct field
--> $DIR/missing-doc-impl.rs:9:5
|
LL | a: isize,
| ^^^^^^^^

error: missing documentation for a struct field
--> $DIR/missing-doc-impl.rs:10:5
|
LL | b: isize,
| ^^^^^^^^

error: missing documentation for a struct
--> $DIR/missing-doc-impl.rs:13:1
|
LL | / pub struct PubFoo {
LL | | pub a: isize,
LL | | b: isize,
LL | | }
| |_^

error: missing documentation for a struct field
--> $DIR/missing-doc-impl.rs:14:5
|
LL | pub a: isize,
| ^^^^^^^^^^^^

error: missing documentation for a struct field
--> $DIR/missing-doc-impl.rs:15:5
|
LL | b: isize,
| ^^^^^^^^

error: missing documentation for a trait
--> $DIR/missing-doc-impl.rs:38:1
|
LL | / pub trait C {
LL | | fn foo(&self);
LL | | fn foo_with_impl(&self) {}
LL | | }
| |_^

error: missing documentation for a trait method
--> $DIR/missing-doc-impl.rs:39:5
|
LL | fn foo(&self);
| ^^^^^^^^^^^^^^

error: missing documentation for a trait method
--> $DIR/missing-doc-impl.rs:40:5
|
LL | fn foo_with_impl(&self) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^

error: missing documentation for an associated type
--> $DIR/missing-doc-impl.rs:50:5
|
LL | type AssociatedType;
| ^^^^^^^^^^^^^^^^^^^^

error: missing documentation for an associated type
--> $DIR/missing-doc-impl.rs:51:5
|
LL | type AssociatedTypeDef = Self;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: missing documentation for a method
--> $DIR/missing-doc-impl.rs:62:5
|
LL | pub fn foo() {}
| ^^^^^^^^^^^^^^^

error: missing documentation for a method
--> $DIR/missing-doc-impl.rs:63:5
|
LL | fn bar() {}
| ^^^^^^^^^^^

error: missing documentation for a method
--> $DIR/missing-doc-impl.rs:67:5
|
LL | pub fn foo() {}
| ^^^^^^^^^^^^^^^

error: missing documentation for a method
--> $DIR/missing-doc-impl.rs:70:5
|
LL | fn foo2() {}
| ^^^^^^^^^^^^

error: aborting due to 15 previous errors

81 changes: 1 addition & 80 deletions tests/ui/missing-doc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,14 @@
// When denying at the crate level, be sure to not get random warnings from the
// injected intrinsics by the compiler.
#![allow(dead_code)]
#![feature(associated_type_defaults, global_asm)]
#![feature(global_asm)]

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

type Typedef = String;
pub type PubTypedef = String;

struct Foo {
a: isize,
b: isize,
}

pub struct PubFoo {
pub a: isize,
b: isize,
}

#[allow(clippy::missing_docs_in_private_items)]
pub struct PubFoo2 {
pub a: isize,
pub c: isize,
}

mod module_no_dox {}
pub mod pub_module_no_dox {}

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

/// dox
pub trait A {
/// dox
fn foo(&self);
/// dox
fn foo_with_impl(&self) {}
}

#[allow(clippy::missing_docs_in_private_items)]
trait B {
fn foo(&self);
fn foo_with_impl(&self) {}
}

pub trait C {
fn foo(&self);
fn foo_with_impl(&self) {}
}

#[allow(clippy::missing_docs_in_private_items)]
pub trait D {
fn dummy(&self) {}
}

/// dox
pub trait E {
type AssociatedType;
type AssociatedTypeDef = Self;

/// dox
type DocumentedType;
/// dox
type DocumentedTypeDef = Self;
/// dox
fn dummy(&self) {}
}

impl Foo {
pub fn foo() {}
fn bar() {}
}

impl PubFoo {
pub fn foo() {}
/// dox
pub fn foo1() {}
fn foo2() {}
#[allow(clippy::missing_docs_in_private_items)]
pub fn foo3() {}
}

#[allow(clippy::missing_docs_in_private_items)]
trait F {
fn a();
fn b(&self);
}

// should need to redefine documentation for implementations of traits
impl F for Foo {
fn a() {}
fn b(&self) {}
}

// It sure is nice if doc(hidden) implies allow(missing_docs), and that it
// applies recursively
#[doc(hidden)]
Expand Down
Loading