Skip to content

Commit

Permalink
chore: remove iter copied
Browse files Browse the repository at this point in the history
  • Loading branch information
fundon committed Jan 2, 2024
1 parent d91a7f1 commit b693e24
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions src/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -396,20 +396,16 @@ impl<T: fmt::Debug> Node<T> {
m >= s.len()
};
if right_length {
return bytes
.iter()
.enumerate()
.filter_map(
|(n, b)| if s[0] == *b { Some(n) } else { None },
)
.find_map(|n| {
return bytes.iter().position(|b| s[0] == *b).and_then(
|n| {
node._find(start + n, &bytes[n..], ranges).map(
|id| {
ranges.push(start..start + n);
id
},
)
});
},
);
}
}
None
Expand Down

0 comments on commit b693e24

Please sign in to comment.