@@ -387,6 +387,9 @@ impl<T: fmt::Debug> Node<T> {
387
387
self . _find ( 0 , bytes, & mut ranges) . map ( |t| ( t, ranges) )
388
388
}
389
389
390
+ #[ allow( clippy:: only_used_in_recursion) ]
391
+ #[ allow( clippy:: too_many_lines) ]
392
+ #[ inline]
390
393
pub fn _remove ( & mut self , mut start : usize , mut bytes : & [ u8 ] ) -> Option < T > {
391
394
let mut m = bytes. len ( ) ;
392
395
match & self . key {
@@ -411,24 +414,22 @@ impl<T: fmt::Debug> Node<T> {
411
414
412
415
if m == 0 {
413
416
return self . value . take ( ) ;
414
- } else {
417
+ } else if let Some ( id ) = self . nodes0 . as_mut ( ) . and_then ( |nodes| {
415
418
// static
416
- if let Some ( id) = self . nodes0 . as_mut ( ) . and_then ( |nodes| {
417
- nodes
418
- . binary_search_by ( |node| match & node. key {
419
- Key :: String ( s) => {
420
- // s[0].cmp(&bytes[0])
421
- // opt!
422
- // lets `/` at end
423
- compare ( s[ 0 ] , bytes[ 0 ] )
424
- }
425
- Key :: Parameter ( _) => unreachable ! ( ) ,
426
- } )
427
- . ok ( )
428
- . and_then ( |i| nodes[ i] . _remove ( start, bytes) )
429
- } ) {
430
- return Some ( id) ;
431
- }
419
+ nodes
420
+ . binary_search_by ( |node| match & node. key {
421
+ Key :: String ( s) => {
422
+ // s[0].cmp(&bytes[0])
423
+ // opt!
424
+ // lets `/` at end
425
+ compare ( s[ 0 ] , bytes[ 0 ] )
426
+ }
427
+ Key :: Parameter ( _) => unreachable ! ( ) ,
428
+ } )
429
+ . ok ( )
430
+ . and_then ( |i| nodes[ i] . _remove ( start, bytes) )
431
+ } ) {
432
+ return Some ( id) ;
432
433
}
433
434
434
435
// parameter
@@ -582,10 +583,8 @@ impl<T: fmt::Debug> Node<T> {
582
583
return self . value . take ( ) ;
583
584
}
584
585
} else {
585
- if self . nodes0 . is_none ( ) && self . nodes1 . is_none ( ) {
586
- if self . value . is_some ( ) {
587
- return self . value . take ( ) ;
588
- }
586
+ if self . nodes0 . is_none ( ) && self . nodes1 . is_none ( ) && self . value . is_some ( ) {
587
+ return self . value . take ( ) ;
589
588
}
590
589
591
590
// static
0 commit comments