Skip to content

Commit

Permalink
Remove explicit Inspect impls
Browse files Browse the repository at this point in the history
  • Loading branch information
overlookmotel committed Apr 23, 2024
1 parent 851bc1c commit 79d2808
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 39 deletions.
20 changes: 1 addition & 19 deletions crates/oxc_syntax/src/reference.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ use oxc_index::define_index_type;
use serde::Serialize;

define_index_type! {
#[cfg_attr(feature = "raw", derive(Inspect))]
pub struct ReferenceId = u32;
}

Expand All @@ -25,25 +26,6 @@ export type ReferenceFlag = {
}
"#;

#[cfg(feature = "raw")]
impl Inspect for ReferenceId {
fn name() -> String {
<u32 as Inspect>::name()
}

fn size() -> Option<usize> {
<u32 as Inspect>::size()
}

fn align() -> Option<usize> {
<u32 as Inspect>::align()
}

fn def(collector: &mut TypesCollector) -> DefType {
<u32 as Inspect>::def(collector)
}
}

bitflags! {
#[derive(Debug, Default, Clone, Copy, Eq, PartialEq)]
#[cfg_attr(feature = "serialize", derive(Serialize))]
Expand Down
22 changes: 2 additions & 20 deletions crates/oxc_syntax/src/symbol.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
use bitflags::bitflags;
#[cfg(feature = "raw")]
use layout_inspect::{defs::DefType, Inspect, TypesCollector};
use layout_inspect::Inspect;
use oxc_index::define_index_type;

#[cfg(feature = "serialize")]
use serde::Serialize;

define_index_type! {
#[cfg_attr(feature = "raw", derive(Inspect))]
pub struct SymbolId = u32;
}

Expand All @@ -17,25 +18,6 @@ export type SymbolId = number;
export type SymbolFlags = unknown;
"#;

#[cfg(feature = "raw")]
impl Inspect for SymbolId {
fn name() -> String {
<u32 as Inspect>::name()
}

fn size() -> Option<usize> {
<u32 as Inspect>::size()
}

fn align() -> Option<usize> {
<u32 as Inspect>::align()
}

fn def(collector: &mut TypesCollector) -> DefType {
<u32 as Inspect>::def(collector)
}
}

bitflags! {
#[derive(Debug, Clone, Copy)]
#[cfg_attr(feature = "serialize", derive(Serialize))]
Expand Down

0 comments on commit 79d2808

Please sign in to comment.