Skip to content

Commit 8b764fe

Browse files
authored
Make lint items pub(crate), hiding them from docs (#483)
Right now the lint static and lint pass type are visible in the documentation: <img width="528" alt="image" src="https://github.com/user-attachments/assets/bbc7b754-6c1d-44e3-9b1f-72b585e0d62d" /> This originally was because these items had extra documentation useful to users. Since that's no longer the case, and these items now have no documentation, they can be made `pub(crate)` and hidden from the docs.
1 parent 321262b commit 8b764fe

11 files changed

+21
-21
lines changed

bevy_lint/src/lints/cargo.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use rustc_session::{config::Input, utils::was_invoked_from_cargo};
99
use rustc_span::Symbol;
1010

1111
declare_bevy_lint_pass! {
12-
pub Cargo => [DUPLICATE_BEVY_DEPENDENCIES],
12+
pub(crate) Cargo => [DUPLICATE_BEVY_DEPENDENCIES],
1313
@default = {
1414
bevy: Symbol = sym!(bevy),
1515
},

bevy_lint/src/lints/nursery/duplicate_bevy_dependencies.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ use serde::Deserialize;
7878
use toml::Spanned;
7979

8080
declare_bevy_lint! {
81-
pub DUPLICATE_BEVY_DEPENDENCIES,
81+
pub(crate) DUPLICATE_BEVY_DEPENDENCIES,
8282
super::Nursery,
8383
"multiple versions of the `bevy` crate found",
8484
@crate_level_only = true,
@@ -98,7 +98,7 @@ fn toml_span(range: Range<usize>, file: &SourceFile) -> Span {
9898
)
9999
}
100100

101-
pub fn check(cx: &LateContext<'_>, metadata: &Metadata, bevy_symbol: Symbol) {
101+
pub(crate) fn check(cx: &LateContext<'_>, metadata: &Metadata, bevy_symbol: Symbol) {
102102
// no reason to continue the check if there is only one instance of `bevy` required
103103
if find_crates(cx.tcx, bevy_symbol).len() == 1 {
104104
return;

bevy_lint/src/lints/nursery/zst_query.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,15 +67,15 @@ use rustc_middle::ty::{
6767
};
6868

6969
declare_bevy_lint! {
70-
pub ZST_QUERY,
70+
pub(crate) ZST_QUERY,
7171
// This will eventually be a `RESTRICTION` lint, but due to
7272
// <https://github.com/TheBevyFlock/bevy_cli/issues/279> it is not yet ready for production.
7373
super::Nursery,
7474
"queried a zero-sized type",
7575
}
7676

7777
declare_bevy_lint_pass! {
78-
pub ZstQuery => [ZST_QUERY],
78+
pub(crate) ZstQuery => [ZST_QUERY],
7979
}
8080

8181
impl<'tcx> LateLintPass<'tcx> for ZstQuery {

bevy_lint/src/lints/pedantic/borrowed_reborrowable.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,13 +111,13 @@ use rustc_middle::ty::{Interner, Ty, TyKind, TypeVisitable, TypeVisitor};
111111
use rustc_span::{Span, def_id::LocalDefId, symbol::kw};
112112

113113
declare_bevy_lint! {
114-
pub BORROWED_REBORROWABLE,
114+
pub(crate) BORROWED_REBORROWABLE,
115115
super::Pedantic,
116116
"function parameter takes a mutable reference to a re-borrowable type",
117117
}
118118

119119
declare_bevy_lint_pass! {
120-
pub BorrowedReborrowable => [BORROWED_REBORROWABLE],
120+
pub(crate) BorrowedReborrowable => [BORROWED_REBORROWABLE],
121121
}
122122

123123
impl<'tcx> LateLintPass<'tcx> for BorrowedReborrowable {

bevy_lint/src/lints/pedantic/main_return_without_appexit.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,13 @@ use rustc_span::{Span, Symbol};
4545
use std::ops::ControlFlow;
4646

4747
declare_bevy_lint! {
48-
pub MAIN_RETURN_WITHOUT_APPEXIT,
48+
pub(crate) MAIN_RETURN_WITHOUT_APPEXIT,
4949
super::Pedantic,
5050
"an entrypoint that calls `App::run()` does not return `AppExit`",
5151
}
5252

5353
declare_bevy_lint_pass! {
54-
pub MainReturnWithoutAppExit => [MAIN_RETURN_WITHOUT_APPEXIT],
54+
pub(crate) MainReturnWithoutAppExit => [MAIN_RETURN_WITHOUT_APPEXIT],
5555
@default = {
5656
run: Symbol = sym!(run),
5757
},

bevy_lint/src/lints/restriction/missing_reflect.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,15 +72,15 @@ use rustc_middle::{span_bug, ty::TyCtxt};
7272
use rustc_span::Span;
7373

7474
declare_bevy_lint! {
75-
pub MISSING_REFLECT,
75+
pub(crate) MISSING_REFLECT,
7676
super::Restriction,
7777
"defined a component, resource, or event without a `Reflect` implementation",
7878
// We only override `check_crate()`.
7979
@crate_level_only = true,
8080
}
8181

8282
declare_bevy_lint_pass! {
83-
pub MissingReflect => [MISSING_REFLECT],
83+
pub(crate) MissingReflect => [MISSING_REFLECT],
8484
}
8585

8686
impl<'tcx> LateLintPass<'tcx> for MissingReflect {

bevy_lint/src/lints/restriction/panicking_methods.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,13 @@ use rustc_middle::ty::Ty;
6363
use rustc_span::Symbol;
6464

6565
declare_bevy_lint! {
66-
pub PANICKING_METHODS,
66+
pub(crate) PANICKING_METHODS,
6767
super::Restriction,
6868
"called a method that can panic when a non-panicking alternative exists",
6969
}
7070

7171
declare_bevy_lint_pass! {
72-
pub PanickingMethods => [PANICKING_METHODS],
72+
pub(crate) PanickingMethods => [PANICKING_METHODS],
7373
}
7474

7575
impl<'tcx> LateLintPass<'tcx> for PanickingMethods {

bevy_lint/src/lints/style/unconventional_naming.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,13 @@ use rustc_span::symbol::Ident;
5858
use crate::{declare_bevy_lint, declare_bevy_lint_pass, utils::hir_parse::impls_trait};
5959

6060
declare_bevy_lint! {
61-
pub UNCONVENTIONAL_NAMING,
61+
pub(crate) UNCONVENTIONAL_NAMING,
6262
super::Style,
6363
"unconventional type name for a `Plugin` or `SystemSet`",
6464
}
6565

6666
declare_bevy_lint_pass! {
67-
pub UnconventionalNaming => [UNCONVENTIONAL_NAMING],
67+
pub(crate) UnconventionalNaming => [UNCONVENTIONAL_NAMING],
6868
}
6969

7070
impl<'tcx> LateLintPass<'tcx> for UnconventionalNaming {

bevy_lint/src/lints/suspicious/insert_event_resource.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,13 @@ use rustc_span::Symbol;
5757
use std::borrow::Cow;
5858

5959
declare_bevy_lint! {
60-
pub INSERT_EVENT_RESOURCE,
60+
pub(crate) INSERT_EVENT_RESOURCE,
6161
super::Suspicious,
6262
"called `App::insert_resource(Events<T>)` or `App::init_resource::<Events<T>>()` instead of `App::add_event::<T>()`",
6363
}
6464

6565
declare_bevy_lint_pass! {
66-
pub InsertEventResource => [INSERT_EVENT_RESOURCE],
66+
pub(crate) InsertEventResource => [INSERT_EVENT_RESOURCE],
6767
@default = {
6868
insert_resource: Symbol = sym!(insert_resource),
6969
init_resource: Symbol = sym!(init_resource),

bevy_lint/src/lints/suspicious/insert_unit_bundle.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,13 @@ use rustc_span::Symbol;
6060
use crate::{declare_bevy_lint, declare_bevy_lint_pass, utils::hir_parse::MethodCall};
6161

6262
declare_bevy_lint! {
63-
pub INSERT_UNIT_BUNDLE,
63+
pub(crate) INSERT_UNIT_BUNDLE,
6464
super::Suspicious,
6565
"inserted a `Bundle` containing a unit `()` type",
6666
}
6767

6868
declare_bevy_lint_pass! {
69-
pub InsertUnitBundle => [INSERT_UNIT_BUNDLE],
69+
pub(crate) InsertUnitBundle => [INSERT_UNIT_BUNDLE],
7070
@default = {
7171
spawn: Symbol = sym!(spawn),
7272
},

0 commit comments

Comments
 (0)