Skip to content

Commit c140536

Browse files
committed
Update state.rs
1 parent f1afe0e commit c140536

File tree

1 file changed

+6
-8
lines changed
  • regex-automata/src/util/determinize

1 file changed

+6
-8
lines changed

regex-automata/src/util/determinize/state.rs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ pub(crate) struct State(Arc<[u8]>);
115115
/// without having to convert it into a State first.
116116
impl core::borrow::Borrow<[u8]> for State {
117117
fn borrow(&self) -> &[u8] {
118-
&*self.0
118+
&self.0
119119
}
120120
}
121121

@@ -177,7 +177,7 @@ impl State {
177177
}
178178

179179
fn repr(&self) -> Repr<'_> {
180-
Repr(&*self.0)
180+
Repr(&self.0)
181181
}
182182
}
183183

@@ -460,12 +460,10 @@ impl<'a> Repr<'a> {
460460
///
461461
/// If this state is not a match state, then this always returns 0.
462462
fn match_len(&self) -> usize {
463-
if !self.is_match() {
464-
return 0;
465-
} else if !self.has_pattern_ids() {
466-
1
467-
} else {
468-
self.encoded_pattern_len()
463+
match (self.is_match(), self.has_pattern_ids()) {
464+
(false, _) => 0,
465+
(true, false) => 1,
466+
(true, true) => self.encoded_pattern_len(),
469467
}
470468
}
471469

0 commit comments

Comments
 (0)