@@ -70,34 +70,32 @@ pub(crate) struct ProjectJsonTargetSpec {
70
70
impl ProjectJsonTargetSpec {
71
71
pub ( crate ) fn runnable_args ( & self , kind : & RunnableKind ) -> Option < Runnable > {
72
72
match kind {
73
- RunnableKind :: Bin => {
74
- for runnable in & self . shell_runnables {
75
- if matches ! ( runnable. kind, project_model:: project_json:: RunnableKind :: Run ) {
76
- return Some ( runnable. clone ( ) ) ;
77
- }
78
- }
79
-
80
- None
81
- }
82
- RunnableKind :: Test { test_id, .. } => {
83
- for runnable in & self . shell_runnables {
84
- if matches ! ( runnable. kind, project_model:: project_json:: RunnableKind :: TestOne ) {
85
- let mut runnable = runnable. clone ( ) ;
86
-
87
- let replaced_args: Vec < _ > = runnable
88
- . args
89
- . iter ( )
90
- . map ( |arg| arg. replace ( "{test_id}" , & test_id. to_string ( ) ) )
91
- . map ( |arg| arg. replace ( "{label}" , & self . label ) )
92
- . collect ( ) ;
93
- runnable. args = replaced_args;
94
-
95
- return Some ( runnable) ;
96
- }
97
- }
98
-
99
- None
100
- }
73
+ RunnableKind :: Bin => self
74
+ . shell_runnables
75
+ . iter ( )
76
+ . find ( |r| matches ! ( r. kind, project_model:: project_json:: RunnableKind :: Run ) )
77
+ . cloned ( )
78
+ . map ( |mut runnable| {
79
+ runnable. args . iter_mut ( ) . for_each ( |arg| {
80
+ * arg = arg. replace ( "{label}" , & self . label ) ;
81
+ } ) ;
82
+
83
+ runnable
84
+ } ) ,
85
+ RunnableKind :: Test { test_id, .. } => self
86
+ . shell_runnables
87
+ . iter ( )
88
+ . find ( |r| matches ! ( r. kind, project_model:: project_json:: RunnableKind :: TestOne ) )
89
+ . cloned ( )
90
+ . map ( |mut runnable| {
91
+ runnable. args . iter_mut ( ) . for_each ( |arg| {
92
+ * arg = arg
93
+ . replace ( "{label}" , & self . label )
94
+ . replace ( "{test_id}" , test_id. as_ref ( ) ) ;
95
+ } ) ;
96
+
97
+ runnable
98
+ } ) ,
101
99
RunnableKind :: TestMod { .. } => None ,
102
100
RunnableKind :: Bench { .. } => None ,
103
101
RunnableKind :: DocTest { .. } => None ,
0 commit comments