-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #12342 - lucarlig:empty-docs, r=llogiq
Empty docs Fixes rust-lang/rust-clippy#9931 changelog: [`empty_doc`]: Detects documentation that is empty. changelog: Doc comment lints now trigger for struct field and enum variant documentation
- Loading branch information
Showing
12 changed files
with
223 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
#![allow(unused)] | ||
#![warn(clippy::empty_docs)] | ||
mod outer { | ||
//! | ||
/// this is a struct | ||
struct Bananas { | ||
/// count | ||
count: usize, | ||
} | ||
|
||
/// | ||
enum Warn { | ||
/// | ||
A, | ||
B, | ||
} | ||
|
||
enum DontWarn { | ||
/// i | ||
A, | ||
B, | ||
} | ||
|
||
#[doc = ""] | ||
fn warn_about_this() {} | ||
|
||
#[doc = ""] | ||
#[doc = ""] | ||
fn this_doesn_warn() {} | ||
|
||
#[doc = "a fine function"] | ||
fn this_is_fine() {} | ||
|
||
/// | ||
mod inner { | ||
/// | ||
fn dont_warn_inner_outer() { | ||
//!w | ||
} | ||
|
||
fn this_is_ok() { | ||
//! | ||
//! inside the function | ||
} | ||
|
||
fn warn() { | ||
/*! */ | ||
} | ||
|
||
fn dont_warn() { | ||
/*! dont warn me */ | ||
} | ||
|
||
trait NoDoc { | ||
/// | ||
fn some() {} | ||
} | ||
} | ||
|
||
union Unite { | ||
/// lint y | ||
x: i32, | ||
/// | ||
y: i32, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
error: empty doc comment | ||
--> tests/ui/empty_docs.rs:4:5 | ||
| | ||
LL | //! | ||
| ^^^ | ||
| | ||
= help: consider removing or filling it | ||
= note: `-D clippy::empty-docs` implied by `-D warnings` | ||
= help: to override `-D warnings` add `#[allow(clippy::empty_docs)]` | ||
|
||
error: empty doc comment | ||
--> tests/ui/empty_docs.rs:12:5 | ||
| | ||
LL | /// | ||
| ^^^ | ||
| | ||
= help: consider removing or filling it | ||
|
||
error: empty doc comment | ||
--> tests/ui/empty_docs.rs:14:9 | ||
| | ||
LL | /// | ||
| ^^^ | ||
| | ||
= help: consider removing or filling it | ||
|
||
error: empty doc comment | ||
--> tests/ui/empty_docs.rs:25:5 | ||
| | ||
LL | #[doc = ""] | ||
| ^^^^^^^^^^^ | ||
| | ||
= help: consider removing or filling it | ||
|
||
error: empty doc comment | ||
--> tests/ui/empty_docs.rs:28:5 | ||
| | ||
LL | / #[doc = ""] | ||
LL | | #[doc = ""] | ||
| |_______________^ | ||
| | ||
= help: consider removing or filling it | ||
|
||
error: empty doc comment | ||
--> tests/ui/empty_docs.rs:35:5 | ||
| | ||
LL | /// | ||
| ^^^ | ||
| | ||
= help: consider removing or filling it | ||
|
||
error: empty doc comment | ||
--> tests/ui/empty_docs.rs:48:13 | ||
| | ||
LL | /*! */ | ||
| ^^^^^^ | ||
| | ||
= help: consider removing or filling it | ||
|
||
error: empty doc comment | ||
--> tests/ui/empty_docs.rs:56:13 | ||
| | ||
LL | /// | ||
| ^^^ | ||
| | ||
= help: consider removing or filling it | ||
|
||
error: empty doc comment | ||
--> tests/ui/empty_docs.rs:64:9 | ||
| | ||
LL | /// | ||
| ^^^ | ||
| | ||
= help: consider removing or filling it | ||
|
||
error: aborting due to 9 previous errors | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters