Skip to content

Commit 55a1311

Browse files
committed
refactor(minifier): remove redundant comments (#27829)
Remove four comments that repeat the adjacent operations in the minifier peephole optimizations.
1 parent 2537ad4 commit 55a1311

3 files changed

Lines changed: 0 additions & 4 deletions

File tree

‎crates/oxc_minifier/src/peephole/minimize_for_statement.rs‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ use super::PeepholeOptimizations;
99
impl<'a> PeepholeOptimizations {
1010
/// `mangleFor`: <https://github.com/evanw/esbuild/blob/v0.24.2/internal/js_ast/js_parser.go#L9801>
1111
pub fn minimize_for_statement(for_stmt: &mut ForStatement<'a>, ctx: &mut TraverseCtx<'a>) {
12-
// Get the first statement in the loop
1312
let mut first = &for_stmt.body;
1413
if let Statement::BlockStatement(block_stmt) = first {
1514
if let Some(b) = block_stmt.body.first() {

‎crates/oxc_minifier/src/peephole/minimize_imports_exports.rs‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,6 @@ impl<'a> PeepholeOptimizations {
247247
ArenaHashMap::new_in(ctx.allocator());
248248
let mut merges = ArenaVec::new_in(ctx);
249249

250-
// Collect the candidates
251250
for (statement_index, stmt) in stmts.iter().enumerate() {
252251
match stmt {
253252
Statement::ImportDeclaration(import_decl) => {

‎crates/oxc_minifier/src/peephole/remove_dead_code.rs‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,6 @@ impl<'a> PeepholeOptimizations {
272272
_ => {}
273273
},
274274
Some(true) => {
275-
// Remove the test expression.
276275
if let Some(old) = for_stmt.test.take() {
277276
ctx.drop_expression(&old);
278277
}
@@ -334,7 +333,6 @@ impl<'a> PeepholeOptimizations {
334333
// https://github.com/evanw/esbuild/commit/add452ed51333953dd38a26f28a775bb220ea2e9
335334
let case_count = switch_stmt.cases.len();
336335
if case_count == 1 {
337-
// Remove sole case if empty and has no side-effect test
338336
if Self::is_switch_case_removable(&switch_stmt.cases[0], true) {
339337
ctx.drop_switch_case(&switch_stmt.cases.pop().unwrap());
340338
}

0 commit comments

Comments
 (0)