Skip to content

Commit

Permalink
refactor: lint.
Browse files Browse the repository at this point in the history
  • Loading branch information
7086cmd committed Oct 1, 2024
1 parent 9fdd3da commit 83e8c17
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions crates/oxc_minifier/src/ast_passes/peephole_fold_constants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -194,13 +194,13 @@ impl<'a> PeepholeFoldConstants {
.then(|| {
// Use `unwrap`, because we know it's a valid BigInt literal, which ends with 'n'.
let value = BigInt::from_str(n.raw.as_str().strip_suffix('n').unwrap());
value.ok().and_then(|value| {
value.ok().map(|value| {
let value = !value;
Some(ctx.ast.expression_big_int_literal(
ctx.ast.expression_big_int_literal(
SPAN,
value.to_string() + "n",
BigintBase::Decimal,
))
)
})
})
.unwrap_or(None),
Expand Down Expand Up @@ -232,12 +232,12 @@ impl<'a> PeepholeFoldConstants {
value
.ok()
.and_then(|value| value.checked_sub(&BigInt::from(1)))
.and_then(|value| {
Some(ctx.ast.expression_big_int_literal(
.map(|value| {
ctx.ast.expression_big_int_literal(
SPAN,
value.neg().to_string() + "n",
BigintBase::Decimal,
))
)
})
})
.unwrap_or(None)
Expand Down Expand Up @@ -266,7 +266,7 @@ impl<'a> PeepholeFoldConstants {
}
_ => None,
},
_ => None,
UnaryOperator::Delete => None
}
}

Expand Down

0 comments on commit 83e8c17

Please sign in to comment.