mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-23 21:23:56 +00:00
Address review comments
This commit is contained in:
parent
64b8aaf91a
commit
c29e767ef1
4 changed files with 24 additions and 9 deletions
|
@ -103,7 +103,7 @@ impl MissingDoc {
|
||||||
|
|
||||||
if self.crate_items_only && def_id != CRATE_DEF_ID {
|
if self.crate_items_only && def_id != CRATE_DEF_ID {
|
||||||
let vis = cx.tcx.visibility(def_id);
|
let vis = cx.tcx.visibility(def_id);
|
||||||
if vis != Visibility::Public && vis != Visibility::Restricted(CRATE_DEF_ID.into()) {
|
if vis == Visibility::Public || vis != Visibility::Restricted(CRATE_DEF_ID.into()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -456,7 +456,8 @@ define_Conf! {
|
||||||
(suppress_restriction_lint_in_const: bool = false),
|
(suppress_restriction_lint_in_const: bool = false),
|
||||||
/// Lint: MISSING_DOCS_IN_PRIVATE_ITEMS.
|
/// Lint: MISSING_DOCS_IN_PRIVATE_ITEMS.
|
||||||
///
|
///
|
||||||
/// Whether to **only** check for missing documentation in `pub(crate)` items.
|
/// Whether to **only** check for missing documentation in items visible within the current
|
||||||
|
/// crate. For example, `pub(crate)` items.
|
||||||
(missing_docs_in_crate_items: bool = false),
|
(missing_docs_in_crate_items: bool = false),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
//! this is crate
|
//! this is crate
|
||||||
|
#![allow(missing_docs)]
|
||||||
#![warn(clippy::missing_docs_in_private_items)]
|
#![warn(clippy::missing_docs_in_private_items)]
|
||||||
|
|
||||||
/// this is mod
|
/// this is mod
|
||||||
|
@ -45,6 +46,13 @@ mod my_mod {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// some docs
|
||||||
|
type CrateTypedefWithDocs = String;
|
||||||
|
type CrateTypedefNoDocs = String;
|
||||||
|
/// some docs
|
||||||
|
pub type PubTypedefWithDocs = String;
|
||||||
|
pub type PubTypedefNoDocs = String;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
my_mod::crate_with_docs();
|
my_mod::crate_with_docs();
|
||||||
my_mod::crate_no_docs();
|
my_mod::crate_no_docs();
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
error: missing documentation for a function
|
error: missing documentation for a function
|
||||||
--> $DIR/pub_crate_missing_doc.rs:11:5
|
--> $DIR/pub_crate_missing_doc.rs:12:5
|
||||||
|
|
|
|
||||||
LL | pub(crate) fn crate_no_docs() {}
|
LL | pub(crate) fn crate_no_docs() {}
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
@ -7,25 +7,25 @@ LL | pub(crate) fn crate_no_docs() {}
|
||||||
= note: `-D clippy::missing-docs-in-private-items` implied by `-D warnings`
|
= note: `-D clippy::missing-docs-in-private-items` implied by `-D warnings`
|
||||||
|
|
||||||
error: missing documentation for a function
|
error: missing documentation for a function
|
||||||
--> $DIR/pub_crate_missing_doc.rs:14:5
|
--> $DIR/pub_crate_missing_doc.rs:15:5
|
||||||
|
|
|
|
||||||
LL | pub(super) fn super_no_docs() {}
|
LL | pub(super) fn super_no_docs() {}
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: missing documentation for a function
|
error: missing documentation for a function
|
||||||
--> $DIR/pub_crate_missing_doc.rs:22:9
|
--> $DIR/pub_crate_missing_doc.rs:23:9
|
||||||
|
|
|
|
||||||
LL | pub(crate) fn sub_crate_no_docs() {}
|
LL | pub(crate) fn sub_crate_no_docs() {}
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: missing documentation for a struct field
|
error: missing documentation for a struct field
|
||||||
--> $DIR/pub_crate_missing_doc.rs:32:9
|
--> $DIR/pub_crate_missing_doc.rs:33:9
|
||||||
|
|
|
|
||||||
LL | pub(crate) crate_field_no_docs: (),
|
LL | pub(crate) crate_field_no_docs: (),
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: missing documentation for a struct
|
error: missing documentation for a struct
|
||||||
--> $DIR/pub_crate_missing_doc.rs:38:5
|
--> $DIR/pub_crate_missing_doc.rs:39:5
|
||||||
|
|
|
|
||||||
LL | / pub(crate) struct CrateStructNoDocs {
|
LL | / pub(crate) struct CrateStructNoDocs {
|
||||||
LL | | /// some docs
|
LL | | /// some docs
|
||||||
|
@ -37,10 +37,16 @@ LL | | }
|
||||||
| |_____^
|
| |_____^
|
||||||
|
|
||||||
error: missing documentation for a struct field
|
error: missing documentation for a struct field
|
||||||
--> $DIR/pub_crate_missing_doc.rs:41:9
|
--> $DIR/pub_crate_missing_doc.rs:42:9
|
||||||
|
|
|
|
||||||
LL | pub(crate) crate_field_no_docs: (),
|
LL | pub(crate) crate_field_no_docs: (),
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: aborting due to 6 previous errors
|
error: missing documentation for a type alias
|
||||||
|
--> $DIR/pub_crate_missing_doc.rs:51:1
|
||||||
|
|
|
||||||
|
LL | type CrateTypedefNoDocs = String;
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
error: aborting due to 7 previous errors
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue