This repository was archived by the owner on Feb 22, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +12
-8
lines changed Expand file tree Collapse file tree 2 files changed +12
-8
lines changed Original file line number Diff line number Diff line change @@ -37,8 +37,10 @@ pub struct Child {
37
37
name : String ,
38
38
}
39
39
40
- pub fn new_child_matcher ( name : String ) -> Child {
41
- Child { name }
40
+ impl Child {
41
+ pub fn new ( name : String ) -> Self {
42
+ Child { name }
43
+ }
42
44
}
43
45
44
46
impl Matcher for Child {
@@ -51,8 +53,10 @@ pub struct Union {
51
53
elements : Vec < Box < dyn Matcher > > ,
52
54
}
53
55
54
- pub fn new_union ( elements : Vec < Box < dyn Matcher > > ) -> Union {
55
- Union { elements }
56
+ impl Union {
57
+ pub fn new ( elements : Vec < Box < dyn Matcher > > ) -> Self {
58
+ Union { elements }
59
+ }
56
60
}
57
61
58
62
impl Matcher for Union {
Original file line number Diff line number Diff line change @@ -66,7 +66,7 @@ fn parse_dot_child_matcher(
66
66
let mut ms: Vec < Box < dyn matchers:: Matcher > > = Vec :: new ( ) ;
67
67
for r in matcher_rule. into_inner ( ) {
68
68
if let Rule :: childName = r. as_rule ( ) {
69
- ms. push ( Box :: new ( matchers:: new_child_matcher ( r. as_str ( ) . to_owned ( ) ) ) ) ;
69
+ ms. push ( Box :: new ( matchers:: Child :: new ( r. as_str ( ) . to_owned ( ) ) ) ) ;
70
70
}
71
71
}
72
72
ms
@@ -81,19 +81,19 @@ fn parse_union(matcher_rule: pest::iterators::Pair<Rule>) -> Vec<Box<dyn matcher
81
81
}
82
82
}
83
83
}
84
- vec ! [ Box :: new( matchers:: new_union ( ms) ) ]
84
+ vec ! [ Box :: new( matchers:: Union :: new ( ms) ) ]
85
85
}
86
86
87
87
fn parse_union_child ( matcher_rule : pest:: iterators:: Pair < Rule > ) -> Vec < Box < dyn matchers:: Matcher > > {
88
88
let mut ms: Vec < Box < dyn matchers:: Matcher > > = Vec :: new ( ) ;
89
89
for r in matcher_rule. into_inner ( ) {
90
90
match r. as_rule ( ) {
91
91
Rule :: doubleInner => {
92
- ms. push ( Box :: new ( matchers:: new_child_matcher ( unescape ( r. as_str ( ) ) ) ) ) ;
92
+ ms. push ( Box :: new ( matchers:: Child :: new ( unescape ( r. as_str ( ) ) ) ) ) ;
93
93
}
94
94
95
95
Rule :: singleInner => {
96
- ms. push ( Box :: new ( matchers:: new_child_matcher ( unescape ( r. as_str ( ) ) ) ) ) ;
96
+ ms. push ( Box :: new ( matchers:: Child :: new ( unescape ( r. as_str ( ) ) ) ) ) ;
97
97
}
98
98
99
99
_ => ( ) ,
You can’t perform that action at this time.
0 commit comments