Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions regex-automata/src/meta/wrappers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,11 @@ impl OnePassCache {
pub(crate) fn reset(&mut self, builder: &OnePass) {
#[cfg(feature = "dfa-onepass")]
if let Some(ref e) = builder.0 {
self.0.as_mut().unwrap().reset(&e.0);
if let Some(ref mut cache) = self.0 {
cache.reset(&e.0);
} else {
self.0 = Some(e.0.create_cache());
}
}
}

Expand Down Expand Up @@ -781,7 +785,11 @@ impl HybridCache {
pub(crate) fn reset(&mut self, builder: &Hybrid) {
#[cfg(feature = "hybrid")]
if let Some(ref e) = builder.0 {
self.0.as_mut().unwrap().reset(&e.0);
if let Some(ref mut cache) = self.0 {
cache.reset(&e.0);
} else {
self.0 = Some(e.0.create_cache());
}
}
}

Expand Down Expand Up @@ -1186,7 +1194,11 @@ impl ReverseHybridCache {
pub(crate) fn reset(&mut self, builder: &ReverseHybrid) {
#[cfg(feature = "hybrid")]
if let Some(ref e) = builder.0 {
self.0.as_mut().unwrap().reset(&e.0);
if let Some(ref mut cache) = self.0 {
cache.reset(&e.0);
} else {
self.0 = Some(e.0.create_cache());
}
}
}

Expand Down