@@ -10,7 +10,7 @@ fn round_trip_one_field() {
1010 let input = "---\n layout: post\n ---\n Text\n " ;
1111 let root = parse_document ( & arena, input, & options) ;
1212 let mut buf = Vec :: new ( ) ;
13- format_commonmark ( & root, & options, & mut buf) . unwrap ( ) ;
13+ format_commonmark ( root, & options, & mut buf) . unwrap ( ) ;
1414 assert_eq ! ( & String :: from_utf8( buf) . unwrap( ) , input) ;
1515}
1616
@@ -22,7 +22,7 @@ fn round_trip_wide_delimiter() {
2222 let input = "\u{04fc} \n layout: post\n \u{04fc} \n Text\n " ;
2323 let root = parse_document ( & arena, input, & options) ;
2424 let mut buf = Vec :: new ( ) ;
25- format_commonmark ( & root, & options, & mut buf) . unwrap ( ) ;
25+ format_commonmark ( root, & options, & mut buf) . unwrap ( ) ;
2626 assert_eq ! ( & String :: from_utf8( buf) . unwrap( ) , input) ;
2727}
2828
@@ -105,9 +105,7 @@ fn trailing_space_open() {
105105 let root = parse_document ( & arena, input, & options) ;
106106
107107 let found = root
108- . descendants ( )
109- . filter ( |n| matches ! ( n. data. borrow( ) . value, NodeValue :: FrontMatter ( ..) ) )
110- . next ( ) ;
108+ . descendants ( ) . find ( |n| matches ! ( n. data. borrow( ) . value, NodeValue :: FrontMatter ( ..) ) ) ;
111109
112110 assert ! ( found. is_none( ) , "no FrontMatter expected" ) ;
113111}
@@ -122,9 +120,7 @@ fn leading_space_open() {
122120 let root = parse_document ( & arena, input, & options) ;
123121
124122 let found = root
125- . descendants ( )
126- . filter ( |n| matches ! ( n. data. borrow( ) . value, NodeValue :: FrontMatter ( ..) ) )
127- . next ( ) ;
123+ . descendants ( ) . find ( |n| matches ! ( n. data. borrow( ) . value, NodeValue :: FrontMatter ( ..) ) ) ;
128124
129125 assert ! ( found. is_none( ) , "no FrontMatter expected" ) ;
130126}
@@ -139,9 +135,7 @@ fn leading_space_close() {
139135 let root = parse_document ( & arena, input, & options) ;
140136
141137 let found = root
142- . descendants ( )
143- . filter ( |n| matches ! ( n. data. borrow( ) . value, NodeValue :: FrontMatter ( ..) ) )
144- . next ( ) ;
138+ . descendants ( ) . find ( |n| matches ! ( n. data. borrow( ) . value, NodeValue :: FrontMatter ( ..) ) ) ;
145139
146140 assert ! ( found. is_none( ) , "no FrontMatter expected" ) ;
147141}
@@ -156,9 +150,7 @@ fn trailing_space_close() {
156150 let root = parse_document ( & arena, input, & options) ;
157151
158152 let found = root
159- . descendants ( )
160- . filter ( |n| matches ! ( n. data. borrow( ) . value, NodeValue :: FrontMatter ( ..) ) )
161- . next ( ) ;
153+ . descendants ( ) . find ( |n| matches ! ( n. data. borrow( ) . value, NodeValue :: FrontMatter ( ..) ) ) ;
162154
163155 assert ! ( found. is_none( ) , "no FrontMatter expected" ) ;
164156}
@@ -173,9 +165,7 @@ fn second_line() {
173165 let root = parse_document ( & arena, input, & options) ;
174166
175167 let found = root
176- . descendants ( )
177- . filter ( |n| matches ! ( n. data. borrow( ) . value, NodeValue :: FrontMatter ( ..) ) )
178- . next ( ) ;
168+ . descendants ( ) . find ( |n| matches ! ( n. data. borrow( ) . value, NodeValue :: FrontMatter ( ..) ) ) ;
179169
180170 assert ! ( found. is_none( ) , "no FrontMatter expected" ) ;
181171}
@@ -190,9 +180,7 @@ fn fm_only_with_trailing_newline() {
190180 let root = parse_document ( & arena, input, & options) ;
191181
192182 let found = root
193- . descendants ( )
194- . filter ( |n| matches ! ( n. data. borrow( ) . value, NodeValue :: FrontMatter ( ..) ) )
195- . next ( ) ;
183+ . descendants ( ) . find ( |n| matches ! ( n. data. borrow( ) . value, NodeValue :: FrontMatter ( ..) ) ) ;
196184
197185 assert ! ( found. is_some( ) , "front matter expected" ) ;
198186}
@@ -207,9 +195,7 @@ fn fm_only_without_trailing_newline() {
207195 let root = parse_document ( & arena, input, & options) ;
208196
209197 let found = root
210- . descendants ( )
211- . filter ( |n| matches ! ( n. data. borrow( ) . value, NodeValue :: FrontMatter ( ..) ) )
212- . next ( ) ;
198+ . descendants ( ) . find ( |n| matches ! ( n. data. borrow( ) . value, NodeValue :: FrontMatter ( ..) ) ) ;
213199
214200 assert ! ( found. is_some( ) , "front matter expected" ) ;
215201}
0 commit comments