@@ -205,9 +205,8 @@ impl<T: fmt::Debug> Node<T> {
205205
206206 // last
207207 if self . nodes0 . is_none ( ) && self . nodes1 . is_none ( ) {
208- return self . value . as_ref ( ) . map ( |id | {
208+ return self . value . as_ref ( ) . inspect ( |_ | {
209209 ranges. push ( start..start) ;
210- id
211210 } ) ;
212211 }
213212 } else {
@@ -231,10 +230,11 @@ impl<T: fmt::Debug> Node<T> {
231230 . enumerate ( )
232231 . filter_map ( |( n, b) | ( s[ 0 ] == * b) . then_some ( n) )
233232 . 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+ )
238238 } )
239239 }
240240 Key :: Parameter ( _) => unreachable ! ( ) ,
@@ -318,9 +318,8 @@ impl<T: fmt::Debug> Node<T> {
318318 }
319319
320320 if self . nodes0 . is_none ( ) && self . nodes1 . is_none ( ) {
321- return self . value . as_ref ( ) . map ( |id | {
321+ return self . value . as_ref ( ) . inspect ( |_ | {
322322 ranges. push ( start..start) ;
323- id
324323 } ) ;
325324 }
326325 } else {
@@ -346,10 +345,9 @@ impl<T: fmt::Debug> Node<T> {
346345 . enumerate ( )
347346 . filter_map ( |( n, b) | ( s[ 0 ] == * b) . then_some ( n) )
348347 . find_map ( |n| {
349- node. _find ( start + n, & bytes[ n..] , ranges) . map (
350- |id | {
348+ node. _find ( start + n, & bytes[ n..] , ranges) . inspect (
349+ |_ | {
351350 ranges. push ( start..start + n) ;
352- id
353351 } ,
354352 )
355353 } ) ;
@@ -385,7 +383,7 @@ impl<T: fmt::Debug> Node<T> {
385383
386384 pub fn find ( & self , bytes : & [ u8 ] ) -> Option < ( & T , SmallVec < [ Range < usize > ; 8 ] > ) > {
387385 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) )
389387 }
390388}
391389
0 commit comments