@@ -15,7 +15,7 @@ pub struct TestOptions<'a> {
1515pub fn run_tests (
1616 ws : & Workspace < ' _ > ,
1717 options : & TestOptions < ' _ > ,
18- test_args : & [ String ] ,
18+ test_args : & [ & str ] ,
1919) -> CargoResult < Option < CargoTestError > > {
2020 let compilation = compile_tests ( ws, options) ?;
2121
@@ -42,16 +42,19 @@ pub fn run_tests(
4242pub fn run_benches (
4343 ws : & Workspace < ' _ > ,
4444 options : & TestOptions < ' _ > ,
45- args : & [ String ] ,
45+ args : & [ & str ] ,
4646) -> CargoResult < Option < CargoTestError > > {
47- let mut args = args. to_vec ( ) ;
48- args. push ( "--bench" . to_string ( ) ) ;
4947 let compilation = compile_tests ( ws, options) ?;
5048
5149 if options. no_run {
5250 return Ok ( None ) ;
5351 }
52+
53+ let mut args = args. to_vec ( ) ;
54+ args. push ( "--bench" ) ;
55+
5456 let ( test, errors) = run_unit_tests ( options, & args, & compilation) ?;
57+
5558 match errors. len ( ) {
5659 0 => Ok ( None ) ,
5760 _ => Ok ( Some ( CargoTestError :: new ( test, errors) ) ) ,
@@ -72,7 +75,7 @@ fn compile_tests<'a>(
7275/// Runs the unit and integration tests of a package.
7376fn run_unit_tests (
7477 options : & TestOptions < ' _ > ,
75- test_args : & [ String ] ,
78+ test_args : & [ & str ] ,
7679 compilation : & Compilation < ' _ > ,
7780) -> CargoResult < ( Test , Vec < ProcessError > ) > {
7881 let config = options. compile_opts . config ;
@@ -125,7 +128,7 @@ fn run_unit_tests(
125128
126129fn run_doc_tests (
127130 options : & TestOptions < ' _ > ,
128- test_args : & [ String ] ,
131+ test_args : & [ & str ] ,
129132 compilation : & Compilation < ' _ > ,
130133) -> CargoResult < ( Test , Vec < ProcessError > ) > {
131134 let mut errors = Vec :: new ( ) ;
0 commit comments