Skip to content

Commit babbaca

Browse files
committed
refactor(all): remove pub from modules with no exports (#13618)
Pure refactor. All these generated modules have no exports, so importing them with `pub mod` is misleading - there is nothing to make public. Import them with plain `mod` instead. ```diff mod generated { - pub mod assert_layouts; + mod assert_layouts; } ```
1 parent 78a1146 commit babbaca

File tree

9 files changed

+23
-22
lines changed

9 files changed

+23
-22
lines changed

crates/oxc_allocator/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ pub use dummies::*;
183183
))]
184184
mod generated {
185185
#[cfg(debug_assertions)]
186-
pub mod assert_layouts;
186+
mod assert_layouts;
187187
pub mod fixed_size_constants;
188188
}
189189
#[cfg(all(

crates/oxc_ast/src/lib.rs

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -54,23 +54,24 @@ pub mod precedence;
5454
mod trivia;
5555

5656
mod generated {
57-
#[cfg(debug_assertions)]
58-
pub mod assert_layouts;
59-
pub mod ast_builder;
6057
pub mod ast_kind;
61-
pub mod derive_clone_in;
62-
pub mod derive_content_eq;
63-
pub mod derive_dummy;
58+
59+
#[cfg(debug_assertions)]
60+
mod assert_layouts;
61+
mod ast_builder;
62+
mod derive_clone_in;
63+
mod derive_content_eq;
64+
mod derive_dummy;
6465
#[cfg(feature = "serialize")]
65-
pub mod derive_estree;
66-
pub mod derive_get_address;
67-
pub mod derive_get_span;
68-
pub mod derive_get_span_mut;
69-
pub mod derive_take_in;
70-
pub mod get_id;
66+
mod derive_estree;
67+
mod derive_get_address;
68+
mod derive_get_span;
69+
mod derive_get_span_mut;
70+
mod derive_take_in;
71+
mod get_id;
7172
}
7273

73-
pub use generated::{ast_builder, ast_kind};
74+
pub use generated::ast_kind;
7475

7576
pub use crate::{
7677
ast::comment::{Comment, CommentContent, CommentKind, CommentPosition},

crates/oxc_formatter/src/formatter/trivia.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use oxc_syntax::comment_node;
99

1010
use crate::{
1111
formatter::comments::{is_alignable_comment, is_end_of_line_comment, is_own_line_comment},
12-
generated::{ast_nodes::SiblingNode, format},
12+
generated::ast_nodes::SiblingNode,
1313
write,
1414
};
1515

crates/oxc_formatter/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
mod generated {
1313
pub mod ast_nodes;
14-
pub mod format;
14+
mod format;
1515
}
1616
mod formatter;
1717
mod options;

crates/oxc_linter/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ pub mod table;
4242
mod generated {
4343
#[cfg(all(feature = "oxlint2", not(feature = "disable_oxlint2")))]
4444
#[cfg(debug_assertions)]
45-
pub mod assert_layouts;
45+
mod assert_layouts;
4646
mod rule_runner_impls;
4747
}
4848

crates/oxc_regular_expression/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ mod surrogate_pair;
88

99
mod generated {
1010
#[cfg(debug_assertions)]
11-
pub mod assert_layouts;
11+
mod assert_layouts;
1212
mod derive_clone_in;
1313
mod derive_content_eq;
1414
}

crates/oxc_span/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ pub use span::{GetSpan, GetSpanMut, SPAN, Span};
2020

2121
mod generated {
2222
#[cfg(debug_assertions)]
23-
pub mod assert_layouts;
23+
mod assert_layouts;
2424
mod derive_dummy;
2525
#[cfg(feature = "serialize")]
26-
pub mod derive_estree;
26+
mod derive_estree;
2727
}
2828

2929
#[doc(hidden)]

crates/oxc_syntax/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ pub mod xml_entities;
2424

2525
mod generated {
2626
#[cfg(debug_assertions)]
27-
pub mod assert_layouts;
27+
mod assert_layouts;
2828
mod derive_clone_in;
2929
mod derive_content_eq;
3030
mod derive_dummy;

napi/parser/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ pub fn raw_transfer_supported() -> bool {
4848
mod generated {
4949
// Note: We intentionally don't import `generated/derive_estree.rs`. It's not needed.
5050
#[cfg(debug_assertions)]
51-
pub mod assert_layouts;
51+
mod assert_layouts;
5252
#[cfg(all(target_pointer_width = "64", target_endian = "little"))]
5353
pub mod raw_transfer_constants;
5454
}

0 commit comments

Comments
 (0)