Skip to content

Commit fc17846

Browse files
committed
fix: clippy
1 parent d3d5094 commit fc17846

File tree

1 file changed

+14
-13
lines changed

1 file changed

+14
-13
lines changed

Diff for: src/node.rs

+14-13
Original file line numberDiff line numberDiff line change
@@ -229,10 +229,8 @@ impl<T: fmt::Debug> Node<T> {
229229
}
230230
})
231231
.enumerate()
232-
.find_map(|(n, b)| {
233-
if s[0] != *b {
234-
return None;
235-
}
232+
.filter_map(|(n, b)| (s[0] == *b).then_some(n))
233+
.find_map(|n| {
236234
node._find(start + n, &bytes[n..], ranges).map(|id| {
237235
ranges.push(start..start + n);
238236
id
@@ -343,15 +341,18 @@ impl<T: fmt::Debug> Node<T> {
343341
m >= s.len()
344342
};
345343
if right_length {
346-
return bytes.iter().enumerate().find_map(|(n, b)| {
347-
if s[0] != *b {
348-
return None;
349-
}
350-
node._find(start + n, &bytes[n..], ranges).map(|id| {
351-
ranges.push(start..start + n);
352-
id
353-
})
354-
});
344+
return bytes
345+
.iter()
346+
.enumerate()
347+
.filter_map(|(n, b)| (s[0] == *b).then_some(n))
348+
.find_map(|n| {
349+
node._find(start + n, &bytes[n..], ranges).map(
350+
|id| {
351+
ranges.push(start..start + n);
352+
id
353+
},
354+
)
355+
});
355356
}
356357
}
357358
None

0 commit comments

Comments
 (0)