Address review comments

This commit is contained in:
Christian Poveda 2023-02-17 09:09:44 -05:00
parent 64b8aaf91a
commit c29e767ef1
No known key found for this signature in database
GPG key ID: 27525EF5E7420A50
4 changed files with 24 additions and 9 deletions

View file

@ -103,7 +103,7 @@ impl MissingDoc {
if self.crate_items_only && def_id != CRATE_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;
}
}

View file

@ -456,7 +456,8 @@ define_Conf! {
(suppress_restriction_lint_in_const: bool = false),
/// 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),
}

View file

@ -1,4 +1,5 @@
//! this is crate
#![allow(missing_docs)]
#![warn(clippy::missing_docs_in_private_items)]
/// 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() {
my_mod::crate_with_docs();
my_mod::crate_no_docs();

View file

@ -1,5 +1,5 @@
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() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -7,25 +7,25 @@ LL | pub(crate) fn crate_no_docs() {}
= note: `-D clippy::missing-docs-in-private-items` implied by `-D warnings`
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() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
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() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
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: (),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
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 | | /// some docs
@ -37,10 +37,16 @@ LL | | }
| |_____^
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: (),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
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