We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b693e24 commit 4b22405Copy full SHA for 4b22405
src/node.rs
@@ -396,16 +396,15 @@ impl<T: fmt::Debug> Node<T> {
396
m >= s.len()
397
};
398
if right_length {
399
- return bytes.iter().position(|b| s[0] == *b).and_then(
400
- |n| {
401
- node._find(start + n, &bytes[n..], ranges).map(
402
- |id| {
403
- ranges.push(start..start + n);
404
- id
405
- },
406
- )
407
408
- );
+ return bytes.iter().enumerate().find_map(|(n, b)| {
+ if s[0] != *b {
+ return None;
+ }
+ node._find(start + n, &bytes[n..], ranges).map(|id| {
+ ranges.push(start..start + n);
+ id
+ })
+ });
409
}
410
411
None
0 commit comments