-
-
Notifications
You must be signed in to change notification settings - Fork 758
refactor: enable more perf rule #12901
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Deploying rspack with
|
| Latest commit: |
0dc4128
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://07d1c756.rspack-v2.pages.dev |
| Branch Preview URL: | https://yj-remove-clone.rspack-v2.pages.dev |
0dc4128 to
01410e0
Compare
01410e0 to
e61334e
Compare
Rsdoctor Bundle Diff AnalysisFound 5 projects in monorepo, 0 projects with changes. 📊 Quick Summary
Generated by Rsdoctor GitHub Action |
📦 Binary Size-limit
🎉 Size decreased by 2.25KB from 48.31MB to 48.30MB (⬇️0.00%) |
Merging this PR will not alter performance
Comparing Footnotes
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR enables the redundant_clone Clippy lint rule to improve performance by identifying and removing unnecessary clone operations throughout the rspack codebase. The lint rule is configured as a warning in the workspace's Cargo.toml, and all identified redundant clones have been removed.
Changes:
- Added
redundant_clone = "warn"to the Clippy lints configuration in Cargo.toml - Removed 50+ unnecessary
.clone()calls across 30 Rust source files - Changes span core modules, plugins, loaders, and test files
Reviewed changes
Copilot reviewed 31 out of 31 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| Cargo.toml | Added redundant_clone lint rule configuration as a warning |
| crates/rspack_tasks/src/lib.rs | Removed clone when getting compiler context (Copy trait) |
| crates/rspack_storage/src/pack/strategy/split/util.rs | Removed clone of filesystem Arc in test utility |
| crates/rspack_plugin_sri/src/html.rs | Removed clone of string in conditional return |
| crates/rspack_plugin_sri/src/asset.rs | Removed clone when moving asset info |
| crates/rspack_plugin_runtime/src/runtime_plugin.rs | Removed trailing clone on method chain result |
| crates/rspack_plugin_rsc/src/server_plugin.rs | Removed clones of strings being moved into EntryOptions |
| crates/rspack_plugin_mf/src/manifest/mod.rs | Removed clone of metadata being consumed |
| crates/rspack_plugin_javascript/src/plugin/module_concatenation_plugin.rs | Removed clones of Option values being moved |
| crates/rspack_plugin_javascript/src/parser_plugin/worker_plugin.rs | Removed clone in and_then closure |
| crates/rspack_plugin_javascript/src/parser_plugin/initialize_evaluating.rs | Removed clone from String::replace result |
| crates/rspack_plugin_javascript/src/parser_plugin/import_parser_plugin.rs | Simplified format! macro without unnecessary clone |
| crates/rspack_plugin_javascript/src/parser_plugin/esm_export_dependency_parser_plugin.rs | Removed clone when converting to Cow |
| crates/rspack_plugin_javascript/src/parser_plugin/compatibility_plugin.rs | Removed clones in format! macros and Cow conversions |
| crates/rspack_plugin_javascript/src/dependency/esm/esm_import_dependency.rs | Removed clones when moving values into init fragments |
| crates/rspack_plugin_javascript/src/dependency/esm/esm_export_imported_specifier_dependency.rs | Removed clone when registering export |
| crates/rspack_plugin_html/src/parser.rs | Removed clone of source string being consumed |
| crates/rspack_plugin_esm_library/src/link.rs | Removed multiple clones in export tracking and symbol management |
| crates/rspack_plugin_esm_library/src/chunk_link.rs | Removed clone in property access insertion |
| crates/rspack_plugin_dll/src/dll_reference/dll_reference_agency_plugin.rs | Removed clone of source being moved |
| crates/rspack_plugin_devtool/src/module_filename_helpers.rs | Removed clone before split operation |
| crates/rspack_plugin_copy/src/lib.rs | Removed clone before method chain |
| crates/rspack_plugin_asset/src/lib.rs | Removed clone of data_url_condition being consumed |
| crates/rspack_macros_test/tests/merge.rs | Removed clones in test calls where value is consumed |
| crates/rspack_loader_swc/src/rsc_transforms/server_actions.rs | Removed multiple clones of identifiers and atoms being moved |
| crates/rspack_core/src/external_module.rs | Removed clones of attributes and Option values |
| crates/rspack_core/src/concatenated_module.rs | Removed clones in Vec concatenation |
| crates/rspack_core/src/compilation/build_module_graph/module_executor/mod.rs | Removed clone of channel sender |
| crates/rspack_core/src/chunk_graph/mod.rs | Removed clone of string being assigned |
| crates/rspack_browser/src/oneshot.rs | Removed clone when constructing receiver |
| crates/rspack/src/builder/mod.rs | Removed unnecessary clones on Option::map results |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Summary
enable redundant_clone rule to avoid unnecessary clone
Related links
Checklist