Skip to content

Commit dcd0279

Browse files
committed
u
1 parent 67ce02b commit dcd0279

File tree

4 files changed

+38
-39
lines changed

4 files changed

+38
-39
lines changed

crates/oxc_codegen/src/gen.rs

+35-38
Original file line numberDiff line numberDiff line change
@@ -846,46 +846,43 @@ impl<'a> Gen for ExportNamedDeclaration<'a> {
846846
if self.export_kind.is_type() {
847847
p.print_str("type ");
848848
}
849-
match &self.declaration {
850-
Some(decl) => {
851-
match decl {
852-
Declaration::VariableDeclaration(decl) => decl.print(p, ctx),
853-
Declaration::FunctionDeclaration(decl) => decl.print(p, ctx),
854-
Declaration::ClassDeclaration(decl) => decl.print(p, ctx),
855-
Declaration::TSModuleDeclaration(decl) => decl.print(p, ctx),
856-
Declaration::TSTypeAliasDeclaration(decl) => decl.print(p, ctx),
857-
Declaration::TSInterfaceDeclaration(decl) => decl.print(p, ctx),
858-
Declaration::TSEnumDeclaration(decl) => decl.print(p, ctx),
859-
Declaration::TSImportEqualsDeclaration(decl) => decl.print(p, ctx),
860-
}
861-
if matches!(
862-
decl,
863-
Declaration::VariableDeclaration(_)
864-
| Declaration::TSTypeAliasDeclaration(_)
865-
| Declaration::TSImportEqualsDeclaration(_)
866-
) {
867-
p.print_semicolon_after_statement();
868-
} else {
869-
p.print_soft_newline();
870-
p.needs_semicolon = false;
871-
}
872-
}
873-
None => {
874-
p.print_ascii_byte(b'{');
875-
if !self.specifiers.is_empty() {
876-
p.print_soft_space();
877-
p.print_list(&self.specifiers, ctx);
878-
p.print_soft_space();
879-
}
880-
p.print_ascii_byte(b'}');
881-
if let Some(source) = &self.source {
882-
p.print_soft_space();
883-
p.print_str("from");
884-
p.print_soft_space();
885-
source.print(p, ctx);
886-
}
849+
if let Some(decl) = &self.declaration {
850+
match decl {
851+
Declaration::VariableDeclaration(decl) => decl.print(p, ctx),
852+
Declaration::FunctionDeclaration(decl) => decl.print(p, ctx),
853+
Declaration::ClassDeclaration(decl) => decl.print(p, ctx),
854+
Declaration::TSModuleDeclaration(decl) => decl.print(p, ctx),
855+
Declaration::TSTypeAliasDeclaration(decl) => decl.print(p, ctx),
856+
Declaration::TSInterfaceDeclaration(decl) => decl.print(p, ctx),
857+
Declaration::TSEnumDeclaration(decl) => decl.print(p, ctx),
858+
Declaration::TSImportEqualsDeclaration(decl) => decl.print(p, ctx),
859+
}
860+
if matches!(
861+
decl,
862+
Declaration::VariableDeclaration(_)
863+
| Declaration::TSTypeAliasDeclaration(_)
864+
| Declaration::TSImportEqualsDeclaration(_)
865+
) {
887866
p.print_semicolon_after_statement();
867+
} else {
868+
p.print_soft_newline();
869+
p.needs_semicolon = false;
870+
}
871+
} else {
872+
p.print_ascii_byte(b'{');
873+
if !self.specifiers.is_empty() {
874+
p.print_soft_space();
875+
p.print_list(&self.specifiers, ctx);
876+
p.print_soft_space();
888877
}
878+
p.print_ascii_byte(b'}');
879+
if let Some(source) = &self.source {
880+
p.print_soft_space();
881+
p.print_str("from");
882+
p.print_soft_space();
883+
source.print(p, ctx);
884+
}
885+
p.print_semicolon_after_statement();
889886
}
890887
}
891888
}

crates/oxc_minifier/src/ast_passes/peephole_fold_constants.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ impl<'a, 'b> PeepholeFoldConstants {
300300
| (ValueType::Boolean, ValueType::Boolean) => {
301301
let left_number = ctx.get_number_value(left)?;
302302
let right_number = ctx.get_number_value(right)?;
303-
let Ok(value) = TryInto::<f64>::try_into(left_number + right_number) else { return None };
303+
let value = left_number + right_number;
304304
// Float if value has a fractional part, otherwise Decimal
305305
let number_base = if is_exact_int64(value) { NumberBase::Decimal } else { NumberBase::Float };
306306
// todo: add raw &str

tasks/ast_tools/src/layout.rs

+1
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,7 @@ impl Layout {
170170
/// Returns the max valid number in a primitive with the size of `n` bytes.
171171
/// Panics
172172
/// For `n` bigger than `16`, Or if it's not a power of 2 number
173+
#[expect(clippy::cast_lossless)]
173174
fn max_val_of_bytes(n: usize) -> u128 {
174175
match n {
175176
1 => u8::MAX as u128,

tasks/ast_tools/src/schema/defs.rs

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ use crate::{
77
TypeId,
88
};
99

10+
#[expect(clippy::large_enum_variant)]
1011
#[derive(Debug, Serialize)]
1112
#[serde(untagged)]
1213
pub enum TypeDef {

0 commit comments

Comments
 (0)