File tree Expand file tree Collapse file tree 1 file changed +8
-21
lines changed Expand file tree Collapse file tree 1 file changed +8
-21
lines changed Original file line number Diff line number Diff line change @@ -188,29 +188,16 @@ pub fn parse_fixture(fixture: &str) -> Vec<FixtureEntry> {
188
188
}
189
189
} ) ;
190
190
191
- let mut res = Vec :: new ( ) ;
192
- let mut meta = None ;
193
- loop {
194
- let mut next_meta = None ;
195
- let mut text = String :: new ( ) ;
196
- for line in lines. by_ref ( ) {
197
- if line. starts_with ( "//-" ) {
198
- next_meta = Some ( line[ "//-" . len ( ) ..] . trim ( ) . to_string ( ) ) ;
199
- break ;
200
- }
201
- text. push_str ( line) ;
202
- text. push ( '\n' ) ;
203
- }
204
-
205
- if let Some ( meta) = meta {
206
- res. push ( FixtureEntry { meta, text } ) ;
207
- }
208
- meta = next_meta;
209
- if meta. is_none ( ) {
210
- break ;
191
+ let mut res: Vec < FixtureEntry > = Vec :: new ( ) ;
192
+ for line in lines. by_ref ( ) {
193
+ if line. starts_with ( "//-" ) {
194
+ let meta = line[ "//-" . len ( ) ..] . trim ( ) . to_string ( ) ;
195
+ res. push ( FixtureEntry { meta, text : String :: new ( ) } )
196
+ } else if let Some ( entry) = res. last_mut ( ) {
197
+ entry. text . push_str ( line) ;
198
+ entry. text . push ( '\n' ) ;
211
199
}
212
200
}
213
-
214
201
res
215
202
}
216
203
You can’t perform that action at this time.
0 commit comments