fix(memrchr): memrchr expects a reference
@@ -238,7 +238,7 @@ impl Metric<RopeInfo> for LinesMetric {
}
fn prev(s: &String, offset: usize) -> Option<usize> {
- memrchr(b'\n', s.as_bytes()[..offset])
+ memrchr(b'\n', &s.as_bytes()[..offset])
.map(|pos| pos + 1)
}
@@ -267,7 +267,7 @@ fn find_leaf_split_for_merge(s: &str) -> usize {
// Try to split at newline boundary (leaning left), if not, then split at codepoint
fn find_leaf_split(s: &str, minsplit: usize) -> usize {
let mut splitpoint = min(MAX_LEAF, s.len() - MIN_LEAF);
- match memrchr(b'\n', s.as_bytes()[minsplit - 1..splitpoint]) {
+ match memrchr(b'\n', &s.as_bytes()[minsplit - 1..splitpoint]) {
Some(pos) => minsplit + pos,
None => {
while !s.is_char_boundary(splitpoint) {
