@@ -19,15 +19,9 @@ pub(super) struct DebuggerCommands {
1919}
2020
2121impl DebuggerCommands {
22- pub fn parse_from (
23- file : & Path ,
24- config : & Config ,
25- debugger_prefixes : & [ & str ] ,
26- ) -> Result < Self , String > {
27- let directives = debugger_prefixes
28- . iter ( )
29- . map ( |prefix| ( format ! ( "{prefix}-command" ) , format ! ( "{prefix}-check" ) ) )
30- . collect :: < Vec < _ > > ( ) ;
22+ pub fn parse_from ( file : & Path , config : & Config , debugger_prefix : & str ) -> Result < Self , String > {
23+ let command_directive = format ! ( "{debugger_prefix}-command" ) ;
24+ let check_directive = format ! ( "{debugger_prefix}-check" ) ;
3125
3226 let mut breakpoint_lines = vec ! [ ] ;
3327 let mut commands = vec ! [ ] ;
@@ -48,14 +42,11 @@ impl DebuggerCommands {
4842 continue ;
4943 } ;
5044
51- for & ( ref command_directive, ref check_directive) in & directives {
52- config
53- . parse_name_value_directive ( & line, command_directive)
54- . map ( |cmd| commands. push ( cmd) ) ;
55-
56- config
57- . parse_name_value_directive ( & line, check_directive)
58- . map ( |cmd| check_lines. push ( ( line_no, cmd) ) ) ;
45+ if let Some ( command) = config. parse_name_value_directive ( & line, & command_directive) {
46+ commands. push ( command) ;
47+ }
48+ if let Some ( pattern) = config. parse_name_value_directive ( & line, & check_directive) {
49+ check_lines. push ( ( line_no, pattern) ) ;
5950 }
6051 }
6152
0 commit comments