@@ -1538,28 +1538,21 @@ impl Build {
15381538 if self . config . dry_run ( ) {
15391539 return ;
15401540 }
1541- self . recurse_ ( src, dst, Path :: new ( "" ) , & |_| true , false )
1541+ self . recurse_ ( src, dst, Path :: new ( "" ) , & |_| true )
15421542 }
15431543
15441544 /// Copies the `src` directory recursively to `dst`. Both are assumed to exist
15451545 /// when this function is called. Unwanted files or directories can be skipped
15461546 /// by returning `false` from the filter function.
15471547 pub fn cp_filtered ( & self , src : & Path , dst : & Path , filter : & dyn Fn ( & Path ) -> bool ) {
15481548 // Immediately recurse with an empty relative path
1549- self . recurse_ ( src, dst, Path :: new ( "" ) , filter, true )
1549+ self . recurse_ ( src, dst, Path :: new ( "" ) , filter)
15501550 }
15511551
15521552 // Inner function does the actual work
15531553 //
15541554 // FIXME: consider merging cp_filtered and cp_r into one function
1555- fn recurse_ (
1556- & self ,
1557- src : & Path ,
1558- dst : & Path ,
1559- relative : & Path ,
1560- filter : & dyn Fn ( & Path ) -> bool ,
1561- remove_dst_dir : bool ,
1562- ) {
1555+ fn recurse_ ( & self , src : & Path , dst : & Path , relative : & Path , filter : & dyn Fn ( & Path ) -> bool ) {
15631556 for f in self . read_dir ( src) {
15641557 let path = f. path ( ) ;
15651558 let name = path. file_name ( ) . unwrap ( ) ;
@@ -1568,11 +1561,8 @@ impl Build {
15681561 // Only copy file or directory if the filter function returns true
15691562 if filter ( & relative) {
15701563 if t ! ( f. file_type( ) ) . is_dir ( ) {
1571- if remove_dst_dir {
1572- let _ = fs:: remove_dir_all ( & dst) ;
1573- }
15741564 self . create_dir ( & dst) ;
1575- self . recurse_ ( & path, & dst, & relative, filter, remove_dst_dir ) ;
1565+ self . recurse_ ( & path, & dst, & relative, filter) ;
15761566 } else {
15771567 let _ = fs:: remove_file ( & dst) ;
15781568 self . copy ( & path, & dst) ;
0 commit comments