chore: improve struct type and remove some useless fields#12071
chore: improve struct type and remove some useless fields#12071
Conversation
✅ Deploy Preview for rspack canceled.
|
There was a problem hiding this comment.
Pull Request Overview
This PR refactors the synchronization strategy for the concatenated_modules_map in the ESM library plugin. The primary change removes an unnecessary Arc wrapper from the RwLock protected map, simplifying the code since the RwLock itself provides sufficient synchronization. Additionally, it removes an unused current_loader field from the RspackLoaderRunnerPlugin struct.
Key changes:
- Simplified the type of
concatenated_modules_mapfromRwLock<Arc<IdentifierIndexMap<ModuleInfo>>>toRwLock<IdentifierIndexMap<ModuleInfo>>, removing redundant wrapping - Updated all references to work with the direct map instead of getting mutable access through
Arc::get_mut - Removed unused
current_loaderfield fromRspackLoaderRunnerPlugin
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| crates/rspack_plugin_esm_library/src/plugin.rs | Updated struct field type, added documentation comment, and removed Arc::new wrapper when assigning to the map |
| crates/rspack_plugin_esm_library/src/link.rs | Removed Arc::get_mut call and updated all function calls to pass mutable references directly |
| crates/rspack_core/src/normal_module.rs | Removed initialization of unused current_loader field |
| crates/rspack_core/src/loader/rspack_loader.rs | Removed unused current_loader field declaration and import |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
📦 Binary Size-limit
🎉 Size decreased by 896bytes from 47.86MB to 47.86MB (⬇️0.00%) |
CodSpeed Performance ReportMerging #12071 will not alter performanceComparing Summary
|
Summary
Remove the
sync::ArcinsideRwLock, remove useless fields in loaderRelated links
Checklist