fix: tighten visibility and resolve clippy warnings#12964
fix: tighten visibility and resolve clippy warnings#12964
Conversation
There was a problem hiding this comment.
Pull request overview
This pull request tightens Rust visibility modifiers across the workspace to reduce unnecessary public API surface and resolve clippy warnings. The changes convert pub to pub(crate), pub(super), or private visibility where appropriate, while also enabling the unreachable_pub lint in workspace configuration.
Changes:
- Systematically reduced visibility from
pubtopub(crate)orpub(super)across ~100+ files - Added
unreachable_publint to workspace Cargo.toml to enforce visibility constraints - Fixed a visibility regression by adding
Layeredto rspack_tracing exports - Added benchmark target setup for rspack_plugin_mf with criterion2 dependency
Reviewed changes
Copilot reviewed 266 out of 267 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| Cargo.toml | Added unreachable_pub = "warn" workspace lint |
| Cargo.lock | Added criterion2 dependency for mf plugin benchmarks |
| crates/rspack_tracing/src/lib.rs | Added Layered to public exports to fix regression |
| crates/rspack_binding_api/src/lib.rs | Added #![allow(unreachable_pub)] for NAPI exports |
| crates/rspack_plugin_mf/Cargo.toml | Added criterion2 dev-dependency |
| crates/rspack_plugin_mf/benches/optimizer_lock_bench.rs | New benchmark file |
| xtask/* | Changed visibility to pub(crate) for command structs |
| crates/rspack_watcher/* | Changed visibility to pub(crate) for internal modules |
| crates/rspack_storage/* | Changed visibility to pub(crate) and pub(super) for internal types |
| crates/rspack_tools/* | Changed visibility to pub(crate) for comparison utilities |
| crates/rspack_plugin_/ | Changed visibility to pub(crate) for internal modules |
| crates/rspack_core/* | Changed visibility to pub(crate) and pub(super) for internal types |
| Various test files | Changed visibility to pub(crate) for test helpers |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Rsdoctor Bundle Diff AnalysisFound 5 projects in monorepo, 0 projects with changes. 📊 Quick Summary
Generated by Rsdoctor GitHub Action |
📦 Binary Size-limit
🙈 Size remains the same at 48.56MB |
CodSpeed Performance ReportMerging this PR will not alter performanceComparing Summary
Footnotes
|
Summary
pub->pub(crate)/pub(super)/ private) across the workspaceunreachable_pubin workspace Rust lints so this is checked continuously--all-targetscan be lintedValidation
cargo clippy --workspace --all-targets -- -W unreachable_pub -D warnings