diff --git a/crates/oxc_codegen/src/gen.rs b/crates/oxc_codegen/src/gen.rs index 560f94466b9aaa..80b78171ccfb41 100644 --- a/crates/oxc_codegen/src/gen.rs +++ b/crates/oxc_codegen/src/gen.rs @@ -846,46 +846,43 @@ impl<'a> Gen for ExportNamedDeclaration<'a> { if self.export_kind.is_type() { p.print_str("type "); } - match &self.declaration { - Some(decl) => { - match decl { - Declaration::VariableDeclaration(decl) => decl.print(p, ctx), - Declaration::FunctionDeclaration(decl) => decl.print(p, ctx), - Declaration::ClassDeclaration(decl) => decl.print(p, ctx), - Declaration::TSModuleDeclaration(decl) => decl.print(p, ctx), - Declaration::TSTypeAliasDeclaration(decl) => decl.print(p, ctx), - Declaration::TSInterfaceDeclaration(decl) => decl.print(p, ctx), - Declaration::TSEnumDeclaration(decl) => decl.print(p, ctx), - Declaration::TSImportEqualsDeclaration(decl) => decl.print(p, ctx), - } - if matches!( - decl, - Declaration::VariableDeclaration(_) - | Declaration::TSTypeAliasDeclaration(_) - | Declaration::TSImportEqualsDeclaration(_) - ) { - p.print_semicolon_after_statement(); - } else { - p.print_soft_newline(); - p.needs_semicolon = false; - } - } - None => { - p.print_ascii_byte(b'{'); - if !self.specifiers.is_empty() { - p.print_soft_space(); - p.print_list(&self.specifiers, ctx); - p.print_soft_space(); - } - p.print_ascii_byte(b'}'); - if let Some(source) = &self.source { - p.print_soft_space(); - p.print_str("from"); - p.print_soft_space(); - source.print(p, ctx); - } + if let Some(decl) = &self.declaration { + match decl { + Declaration::VariableDeclaration(decl) => decl.print(p, ctx), + Declaration::FunctionDeclaration(decl) => decl.print(p, ctx), + Declaration::ClassDeclaration(decl) => decl.print(p, ctx), + Declaration::TSModuleDeclaration(decl) => decl.print(p, ctx), + Declaration::TSTypeAliasDeclaration(decl) => decl.print(p, ctx), + Declaration::TSInterfaceDeclaration(decl) => decl.print(p, ctx), + Declaration::TSEnumDeclaration(decl) => decl.print(p, ctx), + Declaration::TSImportEqualsDeclaration(decl) => decl.print(p, ctx), + } + if matches!( + decl, + Declaration::VariableDeclaration(_) + | Declaration::TSTypeAliasDeclaration(_) + | Declaration::TSImportEqualsDeclaration(_) + ) { p.print_semicolon_after_statement(); + } else { + p.print_soft_newline(); + p.needs_semicolon = false; + } + } else { + p.print_ascii_byte(b'{'); + if !self.specifiers.is_empty() { + p.print_soft_space(); + p.print_list(&self.specifiers, ctx); + p.print_soft_space(); } + p.print_ascii_byte(b'}'); + if let Some(source) = &self.source { + p.print_soft_space(); + p.print_str("from"); + p.print_soft_space(); + source.print(p, ctx); + } + p.print_semicolon_after_statement(); } } } diff --git a/crates/oxc_minifier/src/ast_passes/peephole_fold_constants.rs b/crates/oxc_minifier/src/ast_passes/peephole_fold_constants.rs index 7afac0db095585..0466d4f9ed593f 100644 --- a/crates/oxc_minifier/src/ast_passes/peephole_fold_constants.rs +++ b/crates/oxc_minifier/src/ast_passes/peephole_fold_constants.rs @@ -300,7 +300,7 @@ impl<'a, 'b> PeepholeFoldConstants { | (ValueType::Boolean, ValueType::Boolean) => { let left_number = ctx.get_number_value(left)?; let right_number = ctx.get_number_value(right)?; - let Ok(value) = TryInto::::try_into(left_number + right_number) else { return None }; + let value = left_number + right_number; // Float if value has a fractional part, otherwise Decimal let number_base = if is_exact_int64(value) { NumberBase::Decimal } else { NumberBase::Float }; // todo: add raw &str diff --git a/tasks/ast_tools/src/layout.rs b/tasks/ast_tools/src/layout.rs index d8d58100beecd2..fafe6fb65b4747 100644 --- a/tasks/ast_tools/src/layout.rs +++ b/tasks/ast_tools/src/layout.rs @@ -170,6 +170,7 @@ impl Layout { /// Returns the max valid number in a primitive with the size of `n` bytes. /// Panics /// For `n` bigger than `16`, Or if it's not a power of 2 number +#[expect(clippy::cast_lossless)] fn max_val_of_bytes(n: usize) -> u128 { match n { 1 => u8::MAX as u128, diff --git a/tasks/ast_tools/src/schema/defs.rs b/tasks/ast_tools/src/schema/defs.rs index 46255991654779..a3da7063eef8a8 100644 --- a/tasks/ast_tools/src/schema/defs.rs +++ b/tasks/ast_tools/src/schema/defs.rs @@ -7,6 +7,7 @@ use crate::{ TypeId, }; +#[expect(clippy::large_enum_variant)] #[derive(Debug, Serialize)] #[serde(untagged)] pub enum TypeDef {