Skip to content

Commit 3f92fa8

Browse files
committed
refactor(estree): add #[repr(transparent)] to config structs (#13212)
The `Config*` structs only contain a single field, so mark them `#[repr(transparent)]`. Has no effect on perf, but it doesn't hurt, so on balance I think best to do it.
1 parent 792ae31 commit 3f92fa8

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

crates/oxc_estree/src/serialize/config.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ pub trait Config {
1212
}
1313

1414
/// Config for serializing AST with TypeScript fields.
15+
#[repr(transparent)]
1516
pub struct ConfigTS {
1617
ranges: bool,
1718
}
@@ -32,6 +33,7 @@ impl Config for ConfigTS {
3233
}
3334

3435
/// Config for serializing AST without TypeScript fields.
36+
#[repr(transparent)]
3537
pub struct ConfigJS {
3638
ranges: bool,
3739
}
@@ -52,6 +54,7 @@ impl Config for ConfigJS {
5254
}
5355

5456
/// Config for serializing AST with TypeScript fields, with fixes.
57+
#[repr(transparent)]
5558
pub struct ConfigFixesTS {
5659
ranges: bool,
5760
}
@@ -72,6 +75,7 @@ impl Config for ConfigFixesTS {
7275
}
7376

7477
/// Config for serializing AST without TypeScript fields, with fixes.
78+
#[repr(transparent)]
7579
pub struct ConfigFixesJS {
7680
ranges: bool,
7781
}

0 commit comments

Comments
 (0)