@@ -387,6 +387,9 @@ impl<T: fmt::Debug> Node<T> {
387387 self . _find ( 0 , bytes, & mut ranges) . map ( |t| ( t, ranges) )
388388 }
389389
390+ #[ allow( clippy:: only_used_in_recursion) ]
391+ #[ allow( clippy:: too_many_lines) ]
392+ #[ inline]
390393 pub fn _remove ( & mut self , mut start : usize , mut bytes : & [ u8 ] ) -> Option < T > {
391394 let mut m = bytes. len ( ) ;
392395 match & self . key {
@@ -411,24 +414,22 @@ impl<T: fmt::Debug> Node<T> {
411414
412415 if m == 0 {
413416 return self . value . take ( ) ;
414- } else {
417+ } else if let Some ( id ) = self . nodes0 . as_mut ( ) . and_then ( |nodes| {
415418 // 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) ;
432433 }
433434
434435 // parameter
@@ -582,10 +583,8 @@ impl<T: fmt::Debug> Node<T> {
582583 return self . value . take ( ) ;
583584 }
584585 } 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 ( ) ;
589588 }
590589
591590 // static
0 commit comments