-
-
Notifications
You must be signed in to change notification settings - Fork 721
refactor(minifier): Remove clippy allow directives and fix needless_pass_by_ref_mut warnings in oxc_minifier #13030
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
refactor(minifier): Remove clippy allow directives and fix needless_pass_by_ref_mut warnings in oxc_minifier #13030
Conversation
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. |
CodSpeed Instrumentation Performance ReportMerging #13030 will not alter performanceComparing Summary
|
…ll underlying issues Co-authored-by: Boshen <1430279+Boshen@users.noreply.github.com>
f84fd9a to
c4bf979
Compare
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 refactors the oxc_minifier crate by removing clippy allow directives and fixing the underlying code issues. The main goal is to improve code quality by addressing linting warnings rather than suppressing them.
- Removed global clippy allow directives for
literal_string_with_formatting_argsandneedless_pass_by_ref_mut - Changed function parameters from
&mut Ctx<'a, '_>to&Ctx<'a, '_>for read-only context usage - Added targeted
#[expect(clippy::literal_string_with_formatting_args)]attributes where needed
Reviewed Changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
lib.rs |
Removed global clippy allow directives |
substitute_alternate_syntax.rs |
Changed 4 functions to use immutable context references |
replace_known_methods.rs |
Changed 4 functions to use immutable context references and added targeted clippy expect |
remove_unused_expression.rs |
Added targeted clippy expect for test function |
remove_unused_declaration.rs |
Changed 2 functions to use immutable context references |
remove_dead_code.rs |
Changed 4 functions to use immutable context references |
normalize.rs |
Changed 1 function to use immutable context reference |
mod.rs |
Updated caller sites to use immutable context references |
minimize_statements.rs |
Changed 1 function to use immutable context reference |
minimize_logical_expression.rs |
Changed 2 functions to use immutable context references |
minimize_for_statement.rs |
Changed 1 function to use immutable context reference |
fold_constants.rs |
Changed 4 functions to use immutable context references |
convert_to_dotted_properties.rs |
Changed 1 function to use immutable context reference and added targeted clippy expect |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
This PR removes the clippy allow directives from
oxc_minifier/src/lib.rsand fixes all underlying issues:-#![allow(clippy::literal_string_with_formatting_args, clippy::needless_pass_by_ref_mut)]Changes Made
clippy::literal_string_with_formatting_argsThis directive was removed immediately as there were no violations of this lint rule in the codebase.
clippy::needless_pass_by_ref_mutFixed 24 warnings across 11 peephole optimization files by changing function parameters from
&mut Ctx<'a, '_>to&Ctx<'a, '_>for functions that only read from the context without mutating it.Files updated:
convert_to_dotted_properties.rs- 1 functionfold_constants.rs- 4 functionsminimize_for_statement.rs- 1 functionminimize_logical_expression.rs- 2 functionsminimize_statements.rs- 1 functionnormalize.rs- 1 functionremove_dead_code.rs- 4 functionsremove_unused_declaration.rs- 2 functionsreplace_known_methods.rs- 4 functionssubstitute_alternate_syntax.rs- 4 functionsBenefits
All tests pass and the build succeeds without any clippy warnings.
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.