Skip to content

Commit

Permalink
fix dead code
Browse files Browse the repository at this point in the history
  • Loading branch information
robertbastian committed Feb 26, 2025
1 parent 873b7fd commit c7820c8
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions components/list/src/provider/serde_dfa.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ use zerovec::VarZeroCow;
pub struct SerdeDFA<'data> {
// Safety: These always represent a valid DFA (DFA::from_bytes(dfa_bytes).is_ok())
dfa_bytes: VarZeroCow<'data, [u8]>,
#[cfg(feature = "serde_human")]
#[cfg(feature = "datagen")]
pattern: Option<alloc::borrow::Cow<'data, str>>,
}

Expand Down Expand Up @@ -116,7 +116,7 @@ impl<'data> SerdeDFA<'data> {

Ok(Some(SerdeDFA {
dfa_bytes,
#[cfg(feature = "serde_human")]
#[cfg(feature = "datagen")]
pattern: None,
}))
}
Expand All @@ -132,13 +132,13 @@ impl<'data> SerdeDFA<'data> {
Self {
// SAFETY: safe for VarZeroCow<[u8]>
dfa_bytes: unsafe { VarZeroCow::from_bytes_unchecked(dfa_bytes) },
#[cfg(feature = "serde_human")]
#[cfg(feature = "datagen")]
pattern: None,
}
}

/// Creates a `SerdeDFA` from a regex.
#[cfg(any(feature = "datagen", feature = "serde_human",))]
#[cfg(any(feature = "datagen", feature = "serde_human"))]
pub fn new(pattern: alloc::borrow::Cow<'data, str>) -> Result<Self, icu_provider::DataError> {
use regex_automata::dfa::dense::{Builder, Config};

Expand Down Expand Up @@ -171,6 +171,7 @@ impl<'data> SerdeDFA<'data> {

Ok(Self {
dfa_bytes: VarZeroCow::new_owned(dfa.to_bytes_native_endian().into_boxed_slice()),
#[cfg(feature = "datagen")]
pattern: Some(pattern),
})
}
Expand Down

0 comments on commit c7820c8

Please sign in to comment.