File tree Expand file tree Collapse file tree 2 files changed +6
-7
lines changed Expand file tree Collapse file tree 2 files changed +6
-7
lines changed Original file line number Diff line number Diff line change 1+ use std:: borrow:: Cow ;
2+
13use libtest2:: Case ;
24use libtest2:: FnCase ;
35use libtest2:: RunError ;
@@ -45,7 +47,7 @@ fn collect_tests() -> std::io::Result<Vec<Box<dyn Case>>> {
4547 . to_string_lossy ( )
4648 . into_owned ( ) ;
4749
48- let test = FnCase :: test ( name, move |_| check_file ( & path) ) ;
50+ let test = FnCase :: test ( Cow :: Owned ( name) , move |_| check_file ( & path) ) ;
4951 tests. push ( Box :: new ( test) ) ;
5052 }
5153 } else if file_type. is_dir ( ) {
Original file line number Diff line number Diff line change @@ -28,19 +28,16 @@ impl Case for DynCase {
2828}
2929
3030pub struct FnCase < R > {
31- name : String ,
31+ name : std :: borrow :: Cow < ' static , str > ,
3232 runner : R ,
3333}
3434
3535impl < R > FnCase < R >
3636where
3737 R : Fn ( & TestContext ) -> RunResult + Send + Sync + ' static ,
3838{
39- pub fn test ( name : impl Into < String > , runner : R ) -> Self {
40- Self {
41- name : name. into ( ) ,
42- runner,
43- }
39+ pub const fn test ( name : std:: borrow:: Cow < ' static , str > , runner : R ) -> Self {
40+ Self { name, runner }
4441 }
4542}
4643
You can’t perform that action at this time.
0 commit comments