Skip to content

Commit 08189cd

Browse files
committed
Fix: satisfy nightly clippy question-mark lint
1 parent 91d058f commit 08189cd

1 file changed

Lines changed: 8 additions & 11 deletions

File tree

src/simd.rs

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -213,18 +213,15 @@ unsafe fn find_bytes_sse2(haystack: &[u8], needle: &[u8]) -> Option<usize> {
213213

214214
while pos + needle_len <= haystack_len {
215215
// Find the next occurrence of the first byte
216-
if let Some(offset) = find_byte_sse2(&haystack[pos..], first_byte) {
217-
let candidate_pos = pos + offset;
218-
219-
// Check if the rest matches
220-
if candidate_pos + needle_len <= haystack_len {
221-
if eq_bytes_sse2(&haystack[candidate_pos..candidate_pos + needle_len], needle) {
222-
return Some(candidate_pos);
223-
}
224-
pos = candidate_pos + 1;
225-
} else {
226-
return None;
216+
let offset = find_byte_sse2(&haystack[pos..], first_byte)?;
217+
let candidate_pos = pos + offset;
218+
219+
// Check if the rest matches
220+
if candidate_pos + needle_len <= haystack_len {
221+
if eq_bytes_sse2(&haystack[candidate_pos..candidate_pos + needle_len], needle) {
222+
return Some(candidate_pos);
227223
}
224+
pos = candidate_pos + 1;
228225
} else {
229226
return None;
230227
}

0 commit comments

Comments
 (0)