File tree Expand file tree Collapse file tree 1 file changed +3
-12
lines changed Expand file tree Collapse file tree 1 file changed +3
-12
lines changed Original file line number Diff line number Diff line change @@ -25,8 +25,8 @@ pub struct WildcardedChild {}
25
25
26
26
impl Matcher for WildcardedChild {
27
27
fn select < ' a > ( & self , node : & ' a Value ) -> Box < dyn Iterator < Item = & ' a Value > + ' a > {
28
- if node. is_object ( ) {
29
- Box :: new ( node . as_object ( ) . unwrap ( ) . into_iter ( ) . map ( | ( _k , v ) | v ) )
28
+ if let Some ( m ) = node. as_object ( ) {
29
+ Box :: new ( m . values ( ) )
30
30
} else {
31
31
Box :: new ( iter:: empty ( ) )
32
32
}
@@ -43,16 +43,7 @@ pub fn new_child_matcher(name: String) -> Child {
43
43
44
44
impl Matcher for Child {
45
45
fn select < ' a > ( & ' a self , node : & ' a Value ) -> Box < dyn Iterator < Item = & ' a Value > + ' a > {
46
- if node. is_object ( ) {
47
- let mapping = node. as_object ( ) . unwrap ( ) ;
48
- if mapping. contains_key ( & self . name ) {
49
- Box :: new ( iter:: once ( & mapping[ & self . name ] ) )
50
- } else {
51
- Box :: new ( iter:: empty ( ) )
52
- }
53
- } else {
54
- Box :: new ( iter:: empty ( ) )
55
- }
46
+ Box :: new ( node. get ( & self . name ) . into_iter ( ) )
56
47
}
57
48
}
58
49
You can’t perform that action at this time.
0 commit comments