@@ -205,9 +205,8 @@ impl<T: fmt::Debug> Node<T> {
205
205
206
206
// last
207
207
if self . nodes0 . is_none ( ) && self . nodes1 . is_none ( ) {
208
- return self . value . as_ref ( ) . map ( |id | {
208
+ return self . value . as_ref ( ) . inspect ( |_ | {
209
209
ranges. push ( start..start) ;
210
- id
211
210
} ) ;
212
211
}
213
212
} else {
@@ -231,10 +230,11 @@ impl<T: fmt::Debug> Node<T> {
231
230
. enumerate ( )
232
231
. filter_map ( |( n, b) | ( s[ 0 ] == * b) . then_some ( n) )
233
232
. find_map ( |n| {
234
- node. _find ( start + n, & bytes[ n..] , ranges) . map ( |id| {
235
- ranges. push ( start..start + n) ;
236
- id
237
- } )
233
+ node. _find ( start + n, & bytes[ n..] , ranges) . inspect (
234
+ |_| {
235
+ ranges. push ( start..start + n) ;
236
+ } ,
237
+ )
238
238
} )
239
239
}
240
240
Key :: Parameter ( _) => unreachable ! ( ) ,
@@ -318,9 +318,8 @@ impl<T: fmt::Debug> Node<T> {
318
318
}
319
319
320
320
if self . nodes0 . is_none ( ) && self . nodes1 . is_none ( ) {
321
- return self . value . as_ref ( ) . map ( |id | {
321
+ return self . value . as_ref ( ) . inspect ( |_ | {
322
322
ranges. push ( start..start) ;
323
- id
324
323
} ) ;
325
324
}
326
325
} else {
@@ -346,10 +345,9 @@ impl<T: fmt::Debug> Node<T> {
346
345
. enumerate ( )
347
346
. filter_map ( |( n, b) | ( s[ 0 ] == * b) . then_some ( n) )
348
347
. find_map ( |n| {
349
- node. _find ( start + n, & bytes[ n..] , ranges) . map (
350
- |id | {
348
+ node. _find ( start + n, & bytes[ n..] , ranges) . inspect (
349
+ |_ | {
351
350
ranges. push ( start..start + n) ;
352
- id
353
351
} ,
354
352
)
355
353
} ) ;
@@ -385,7 +383,7 @@ impl<T: fmt::Debug> Node<T> {
385
383
386
384
pub fn find ( & self , bytes : & [ u8 ] ) -> Option < ( & T , SmallVec < [ Range < usize > ; 8 ] > ) > {
387
385
let mut ranges = SmallVec :: < [ Range < usize > ; 8 ] > :: new_const ( ) ; // opt!
388
- return self . _find ( 0 , bytes, & mut ranges) . map ( |t| ( t, ranges) ) ;
386
+ self . _find ( 0 , bytes, & mut ranges) . map ( |t| ( t, ranges) )
389
387
}
390
388
}
391
389
0 commit comments