@@ -299,7 +299,7 @@ impl ProjectBuilder {
299
299
}
300
300
301
301
/// Adds a symlink to a file to the project.
302
- pub fn symlink < T : AsRef < Path > > ( mut self , dst : T , src : T ) -> Self {
302
+ pub fn symlink ( mut self , dst : impl AsRef < Path > , src : impl AsRef < Path > ) -> Self {
303
303
self . symlinks . push ( SymlinkBuilder :: new (
304
304
self . root . root ( ) . join ( dst) ,
305
305
self . root . root ( ) . join ( src) ,
@@ -308,7 +308,7 @@ impl ProjectBuilder {
308
308
}
309
309
310
310
/// Create a symlink to a directory
311
- pub fn symlink_dir < T : AsRef < Path > > ( mut self , dst : T , src : T ) -> Self {
311
+ pub fn symlink_dir ( mut self , dst : impl AsRef < Path > , src : impl AsRef < Path > ) -> Self {
312
312
self . symlinks . push ( SymlinkBuilder :: new_dir (
313
313
self . root . root ( ) . join ( dst) ,
314
314
self . root . root ( ) . join ( src) ,
@@ -368,7 +368,7 @@ impl ProjectBuilder {
368
368
369
369
impl Project {
370
370
/// Copy the test project from a fixed state
371
- pub fn from_template ( template_path : impl AsRef < std :: path :: Path > ) -> Self {
371
+ pub fn from_template ( template_path : impl AsRef < Path > ) -> Self {
372
372
let root = paths:: root ( ) ;
373
373
let project_root = root. join ( "case" ) ;
374
374
snapbox:: dir:: copy_template ( template_path. as_ref ( ) , & project_root) . unwrap ( ) ;
@@ -459,7 +459,7 @@ impl Project {
459
459
/// # let p = cargo_test_support::project().build();
460
460
/// p.change_file("src/lib.rs", "fn new_fn() {}");
461
461
/// ```
462
- pub fn change_file ( & self , path : & str , body : & str ) {
462
+ pub fn change_file ( & self , path : impl AsRef < Path > , body : & str ) {
463
463
FileBuilder :: new ( self . root ( ) . join ( path) , body, false ) . mk ( )
464
464
}
465
465
@@ -530,7 +530,7 @@ impl Project {
530
530
}
531
531
532
532
/// Returns the contents of a path in the project root
533
- pub fn read_file ( & self , path : & str ) -> String {
533
+ pub fn read_file ( & self , path : impl AsRef < Path > ) -> String {
534
534
let full = self . root ( ) . join ( path) ;
535
535
fs:: read_to_string ( & full)
536
536
. unwrap_or_else ( |e| panic ! ( "could not read file {}: {}" , full. display( ) , e) )
@@ -572,12 +572,12 @@ pub fn project() -> ProjectBuilder {
572
572
}
573
573
574
574
/// Generates a project layout in given directory, see [`ProjectBuilder`]
575
- pub fn project_in ( dir : & str ) -> ProjectBuilder {
575
+ pub fn project_in ( dir : impl AsRef < Path > ) -> ProjectBuilder {
576
576
ProjectBuilder :: new ( paths:: root ( ) . join ( dir) . join ( "foo" ) )
577
577
}
578
578
579
579
/// Generates a project layout inside our fake home dir, see [`ProjectBuilder`]
580
- pub fn project_in_home ( name : & str ) -> ProjectBuilder {
580
+ pub fn project_in_home ( name : impl AsRef < Path > ) -> ProjectBuilder {
581
581
ProjectBuilder :: new ( paths:: home ( ) . join ( name) )
582
582
}
583
583
0 commit comments