diff --git a/src/backtrack.rs b/src/backtrack.rs index 2eaeb72e5..6100c1730 100644 --- a/src/backtrack.rs +++ b/src/backtrack.rs @@ -115,8 +115,8 @@ impl<'a, 'm, 'r, 's, I: Input> Bounded<'a, 'm, 'r, 's, I> { // Then we reset all existing allocated space to 0. // Finally, we request more space if we need it. // - // This is all a little circuitous, but doing this unsafely - // doesn't seem to have a measurable impact on performance. + // This is all a little circuitous, but doing this using unchecked + // operations doesn't seem to have a measurable impact on performance. // (Probably because backtracking is limited to such small // inputs/regexes in the first place.) let visited_len = diff --git a/src/dfa.rs b/src/dfa.rs index 3bb4a5205..9ac0c2c39 100644 --- a/src/dfa.rs +++ b/src/dfa.rs @@ -848,7 +848,7 @@ impl<'a> Fsm<'a> { /// next_si transitions to the next state, where the transition input /// corresponds to text[i]. /// - /// This elides bounds checks, and is therefore unsafe. + /// This elides bounds checks, and is therefore not safe. #[cfg_attr(feature = "perf-inline", inline(always))] unsafe fn next_si(&self, si: StatePtr, text: &[u8], i: usize) -> StatePtr { // What is the argument for safety here? @@ -1688,7 +1688,7 @@ impl Transitions { self.num_byte_classes * mem::size_of::() } - /// Like `next`, but uses unchecked access and is therefore unsafe. + /// Like `next`, but uses unchecked access and is therefore not safe. unsafe fn next_unchecked(&self, si: StatePtr, cls: usize) -> StatePtr { debug_assert!((si as usize) < self.table.len()); debug_assert!(cls < self.num_byte_classes); diff --git a/src/expand.rs b/src/expand.rs index fd2ab03ac..70dbf91f4 100644 --- a/src/expand.rs +++ b/src/expand.rs @@ -144,7 +144,8 @@ fn find_cap_ref(replacement: &[u8]) -> Option { } // We just verified that the range 0..cap_end is valid ASCII, so it must // therefore be valid UTF-8. If we really cared, we could avoid this UTF-8 - // check with either unsafe or by parsing the number straight from &[u8]. + // check via an unchecked conversion or by parsing the number straight from + // &[u8]. let cap = str::from_utf8(&rep[i..cap_end]).expect("valid UTF-8 capture name"); Some(CaptureRef {