Skip to content

Conversation

@hardfist
Copy link
Contributor

@hardfist hardfist commented Jan 30, 2026

Summary

enable redundant_clone rule to avoid unnecessary clone

Related links

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).

@github-actions github-actions bot added team The issue/pr is created by the member of Rspack. release: refactor labels Jan 30, 2026
@cloudflare-workers-and-pages
Copy link

Deploying rspack with  Cloudflare Pages  Cloudflare Pages

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

View logs

@hardfist hardfist force-pushed the yj/enable-perf-rule branch from 0dc4128 to 01410e0 Compare February 1, 2026 04:39
@hardfist hardfist changed the title refactor: enable perf rule refactor: enable more perf rule Feb 1, 2026
@hardfist hardfist force-pushed the yj/enable-perf-rule branch from 01410e0 to e61334e Compare February 1, 2026 04:48
@github-actions
Copy link
Contributor

github-actions bot commented Feb 1, 2026

Rsdoctor Bundle Diff Analysis

Found 5 projects in monorepo, 0 projects with changes.

📊 Quick Summary
Project Total Size Change
react-10k 5.7 MB 0
react-1k 825.5 KB 0
react-5k 2.7 MB 0
rome 984.2 KB 0
ui-components 2.3 MB 0

Generated by Rsdoctor GitHub Action

@github-actions
Copy link
Contributor

github-actions bot commented Feb 1, 2026

📦 Binary Size-limit

Comparing e61334e to fix: prevent server actions from being removed in production build (#12898) by Cong-Cong Pan

🎉 Size decreased by 2.25KB from 48.31MB to 48.30MB (⬇️0.00%)

@codspeed-hq
Copy link

codspeed-hq bot commented Feb 1, 2026

Merging this PR will not alter performance

✅ 16 untouched benchmarks
⏩ 1 skipped benchmark1


Comparing yj/enable-perf-rule (e61334e) with main (b7bcbce)

Open in CodSpeed

Footnotes

  1. 1 benchmark was skipped, so the baseline result was used instead. If it was deleted from the codebase, click here and archive it to remove it from the performance reports.

@hardfist hardfist marked this pull request as ready for review February 1, 2026 05:34
Copilot AI review requested due to automatic review settings February 1, 2026 05:34
@hardfist hardfist enabled auto-merge (squash) February 1, 2026 05:34
@hardfist hardfist merged commit fbaba99 into main Feb 1, 2026
104 of 109 checks passed
@hardfist hardfist deleted the yj/enable-perf-rule branch February 1, 2026 05:36
Copy link
Contributor

Copilot AI left a 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release: refactor team The issue/pr is created by the member of Rspack.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants