Skip to content

Commit 4352030

Browse files
Boshencamc314
authored andcommitted
chore(rust): MSRV 1.88.0
1 parent cddc7e3 commit 4352030

File tree

278 files changed

+3780
-4144
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

278 files changed

+3780
-4144
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ description = "A collection of JavaScript tools written in Rust."
1515
edition = "2024"
1616
# MSRV Policy N-2 (12 weeks).
1717
# Balance between the core contributors enjoying the latest version of rustc, while waiting for dependents to catch up.
18-
rust-version = "1.87.0"
18+
rust-version = "1.88.0"
1919

2020
# <https://doc.rust-lang.org/rustc/lints/listing/allowed-by-default.html>
2121
[workspace.lints.rust]

apps/oxfmt/src/walk.rs

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -33,17 +33,16 @@ impl ignore::ParallelVisitor for WalkVisitor {
3333
match entry {
3434
Ok(entry) => {
3535
// Skip if we can't get file type or if it's a directory
36-
if let Some(file_type) = entry.file_type() {
37-
if !file_type.is_dir() {
38-
if let Some(source_type) = get_supported_source_type(entry.path()) {
39-
let walk_entry =
40-
WalkEntry { path: entry.path().as_os_str().into(), source_type };
41-
// Send each entry immediately through the channel
42-
// If send fails, the receiver has been dropped, so stop walking
43-
if self.sender.send(walk_entry).is_err() {
44-
return ignore::WalkState::Quit;
45-
}
46-
}
36+
if let Some(file_type) = entry.file_type()
37+
&& !file_type.is_dir()
38+
&& let Some(source_type) = get_supported_source_type(entry.path())
39+
{
40+
let walk_entry =
41+
WalkEntry { path: entry.path().as_os_str().into(), source_type };
42+
// Send each entry immediately through the channel
43+
// If send fails, the receiver has been dropped, so stop walking
44+
if self.sender.send(walk_entry).is_err() {
45+
return ignore::WalkState::Quit;
4746
}
4847
}
4948
ignore::WalkState::Continue

crates/oxc_allocator/src/vec2/raw_vec.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -815,10 +815,10 @@ impl<T, A: Alloc> RawVec<'_, T, A> {
815815
/// Not sure what safety invariants of this method are! TODO
816816
pub unsafe fn dealloc_buffer(&mut self) {
817817
let elem_size = mem::size_of::<T>();
818-
if elem_size != 0 {
819-
if let Some(layout) = self.current_layout() {
820-
self.alloc.dealloc(self.ptr.cast(), layout);
821-
}
818+
if elem_size != 0
819+
&& let Some(layout) = self.current_layout()
820+
{
821+
self.alloc.dealloc(self.ptr.cast(), layout);
822822
}
823823
}
824824
}

crates/oxc_ast/src/ast_impl/js.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1537,20 +1537,20 @@ impl FunctionBody<'_> {
15371537
impl<'a> ArrowFunctionExpression<'a> {
15381538
/// Get expression part of `ArrowFunctionExpression`: `() => expression_part`.
15391539
pub fn get_expression(&self) -> Option<&Expression<'a>> {
1540-
if self.expression {
1541-
if let Statement::ExpressionStatement(expr_stmt) = &self.body.statements[0] {
1542-
return Some(&expr_stmt.expression);
1543-
}
1540+
if self.expression
1541+
&& let Statement::ExpressionStatement(expr_stmt) = &self.body.statements[0]
1542+
{
1543+
return Some(&expr_stmt.expression);
15441544
}
15451545
None
15461546
}
15471547

15481548
/// Get expression part of `ArrowFunctionExpression`: `() => expression_part`.
15491549
pub fn get_expression_mut(&mut self) -> Option<&mut Expression<'a>> {
1550-
if self.expression {
1551-
if let Statement::ExpressionStatement(expr_stmt) = &mut self.body.statements[0] {
1552-
return Some(&mut expr_stmt.expression);
1553-
}
1550+
if self.expression
1551+
&& let Statement::ExpressionStatement(expr_stmt) = &mut self.body.statements[0]
1552+
{
1553+
return Some(&mut expr_stmt.expression);
15541554
}
15551555
None
15561556
}

crates/oxc_ast/src/ast_impl/literal.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,10 @@ impl StringLiteral<'_> {
8787
while let Some(c) = chars.next() {
8888
if c == '\\' && chars.next() == Some('u') {
8989
let hex = &chars.as_str()[..4];
90-
if let Ok(hex) = u32::from_str_radix(hex, 16) {
91-
if (0xd800..=0xdfff).contains(&hex) {
92-
return false;
93-
}
90+
if let Ok(hex) = u32::from_str_radix(hex, 16)
91+
&& (0xd800..=0xdfff).contains(&hex)
92+
{
93+
return false;
9494
}
9595
}
9696
}

crates/oxc_ast/src/ast_impl/ts.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,10 @@ impl<'a> TSTypeName<'a> {
9494

9595
/// Returns `true` if this is a reference to `const`.
9696
pub fn is_const(&self) -> bool {
97-
if let TSTypeName::IdentifierReference(ident) = self {
98-
if ident.name == "const" {
99-
return true;
100-
}
97+
if let TSTypeName::IdentifierReference(ident) = self
98+
&& ident.name == "const"
99+
{
100+
return true;
101101
}
102102
false
103103
}

crates/oxc_ast_macros/src/ast.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,10 @@ fn modify_struct(item: &mut ItemStruct, args: TokenStream) -> TokenStream {
6464
/// Mutates `item` in place, re-ordering its fields.
6565
fn reorder_struct_fields(item: &mut ItemStruct, args: TokenStream) -> Result<(), &'static str> {
6666
// Skip foreign types
67-
if let Some(TokenTree::Ident(ident)) = args.into_iter().next() {
68-
if ident == "foreign" {
69-
return Ok(());
70-
}
67+
if let Some(TokenTree::Ident(ident)) = args.into_iter().next()
68+
&& ident == "foreign"
69+
{
70+
return Ok(());
7171
}
7272

7373
// Get struct data

crates/oxc_cfg/src/builder/context.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -132,12 +132,11 @@ impl<'a, 'c> QueryCtx<'a, 'c> {
132132

133133
// mark the upper label continue jump point the same as ours if it isn't already assigned,
134134
// NOTE: if it is already assigned there's a resolution before this context.
135-
if let Some(jmp) = continue_jmp {
136-
if let Some(label_ctx @ RefCtxCursor(Ctx { continue_jmp: None, .. })) =
135+
if let Some(jmp) = continue_jmp
136+
&& let Some(label_ctx @ RefCtxCursor(Ctx { continue_jmp: None, .. })) =
137137
self.0.immediate_labeled_ctx()
138-
{
139-
label_ctx.mark_continue(jmp);
140-
}
138+
{
139+
label_ctx.mark_continue(jmp);
141140
}
142141
}
143142

crates/oxc_codegen/src/binary_expr_visitor.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -186,15 +186,15 @@ impl<'a> BinaryExpressionVisitor<'a> {
186186

187187
match self.operator {
188188
BinaryishOperator::Logical(LogicalOperator::Coalesce) => {
189-
if let Expression::LogicalExpression(logical_expr) = e.left() {
190-
if matches!(logical_expr.operator, LogicalOperator::And | LogicalOperator::Or) {
191-
self.left_precedence = Precedence::Prefix;
192-
}
189+
if let Expression::LogicalExpression(logical_expr) = e.left()
190+
&& matches!(logical_expr.operator, LogicalOperator::And | LogicalOperator::Or)
191+
{
192+
self.left_precedence = Precedence::Prefix;
193193
}
194-
if let Expression::LogicalExpression(logical_expr) = e.right() {
195-
if matches!(logical_expr.operator, LogicalOperator::And | LogicalOperator::Or) {
196-
self.right_precedence = Precedence::Prefix;
197-
}
194+
if let Expression::LogicalExpression(logical_expr) = e.right()
195+
&& matches!(logical_expr.operator, LogicalOperator::And | LogicalOperator::Or)
196+
{
197+
self.right_precedence = Precedence::Prefix;
198198
}
199199
}
200200
BinaryishOperator::Binary(BinaryOperator::Exponential) => {

crates/oxc_codegen/src/gen.rs

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -945,10 +945,11 @@ impl Gen for ImportAttribute<'_> {
945945
impl Gen for ExportNamedDeclaration<'_> {
946946
fn r#gen(&self, p: &mut Codegen, ctx: Context) {
947947
p.print_comments_at(self.span.start);
948-
if let Some(Declaration::FunctionDeclaration(func)) = &self.declaration {
949-
if func.pure && p.options.print_annotation_comment() {
950-
p.print_str(NO_SIDE_EFFECTS_NEW_LINE_COMMENT);
951-
}
948+
if let Some(Declaration::FunctionDeclaration(func)) = &self.declaration
949+
&& func.pure
950+
&& p.options.print_annotation_comment()
951+
{
952+
p.print_str(NO_SIDE_EFFECTS_NEW_LINE_COMMENT);
952953
}
953954
p.add_source_mapping(self.span);
954955
p.print_indent();
@@ -1092,10 +1093,11 @@ impl Gen for ExportAllDeclaration<'_> {
10921093
impl Gen for ExportDefaultDeclaration<'_> {
10931094
fn r#gen(&self, p: &mut Codegen, ctx: Context) {
10941095
p.print_comments_at(self.span.start);
1095-
if let ExportDefaultDeclarationKind::FunctionDeclaration(func) = &self.declaration {
1096-
if func.pure && p.options.print_annotation_comment() {
1097-
p.print_str(NO_SIDE_EFFECTS_NEW_LINE_COMMENT);
1098-
}
1096+
if let ExportDefaultDeclarationKind::FunctionDeclaration(func) = &self.declaration
1097+
&& func.pure
1098+
&& p.options.print_annotation_comment()
1099+
{
1100+
p.print_str(NO_SIDE_EFFECTS_NEW_LINE_COMMENT);
10991101
}
11001102
p.add_source_mapping(self.span);
11011103
p.print_indent();
@@ -1586,23 +1588,22 @@ impl Gen for ObjectProperty<'_> {
15861588
if let PropertyKey::StaticIdentifier(key) = &self.key {
15871589
if key.name == "__proto__" {
15881590
shorthand = self.shorthand;
1589-
} else if let Expression::Identifier(ident) = self.value.without_parentheses() {
1590-
if key.name == p.get_identifier_reference_name(ident) {
1591-
shorthand = true;
1592-
}
1591+
} else if let Expression::Identifier(ident) = self.value.without_parentheses()
1592+
&& key.name == p.get_identifier_reference_name(ident)
1593+
{
1594+
shorthand = true;
15931595
}
15941596
}
15951597

15961598
let mut computed = self.computed;
15971599

15981600
// "{ -1: 0 }" must be printed as "{ [-1]: 0 }"
15991601
// "{ 1/0: 0 }" must be printed as "{ [1/0]: 0 }"
1600-
if !computed {
1601-
if let Some(Expression::NumericLiteral(n)) = self.key.as_expression() {
1602-
if n.value.is_sign_negative() || n.value.is_infinite() {
1603-
computed = true;
1604-
}
1605-
}
1602+
if !computed
1603+
&& let Some(Expression::NumericLiteral(n)) = self.key.as_expression()
1604+
&& (n.value.is_sign_negative() || n.value.is_infinite())
1605+
{
1606+
computed = true;
16061607
}
16071608

16081609
if !shorthand {
@@ -2811,10 +2812,9 @@ impl Gen for BindingProperty<'_> {
28112812
BindingPatternKind::AssignmentPattern(assignment_pattern) => {
28122813
if let BindingPatternKind::BindingIdentifier(ident) =
28132814
&assignment_pattern.left.kind
2815+
&& key.name == p.get_binding_identifier_name(ident)
28142816
{
2815-
if key.name == p.get_binding_identifier_name(ident) {
2816-
shorthand = true;
2817-
}
2817+
shorthand = true;
28182818
}
28192819
}
28202820
_ => {}
@@ -3205,12 +3205,12 @@ impl Gen for TSTemplateLiteralType<'_> {
32053205
fn r#gen(&self, p: &mut Codegen, ctx: Context) {
32063206
p.print_str("`");
32073207
for (index, item) in self.quasis.iter().enumerate() {
3208-
if index != 0 {
3209-
if let Some(types) = self.types.get(index - 1) {
3210-
p.print_str("${");
3211-
types.print(p, ctx);
3212-
p.print_str("}");
3213-
}
3208+
if index != 0
3209+
&& let Some(types) = self.types.get(index - 1)
3210+
{
3211+
p.print_str("${");
3212+
types.print(p, ctx);
3213+
p.print_str("}");
32143214
}
32153215
p.print_str(item.value.raw.as_str());
32163216
}

0 commit comments

Comments
 (0)