@@ -1538,28 +1538,21 @@ impl Build {
1538
1538
if self . config . dry_run ( ) {
1539
1539
return ;
1540
1540
}
1541
- self . recurse_ ( src, dst, Path :: new ( "" ) , & |_| true , false )
1541
+ self . recurse_ ( src, dst, Path :: new ( "" ) , & |_| true )
1542
1542
}
1543
1543
1544
1544
/// Copies the `src` directory recursively to `dst`. Both are assumed to exist
1545
1545
/// when this function is called. Unwanted files or directories can be skipped
1546
1546
/// by returning `false` from the filter function.
1547
1547
pub fn cp_filtered ( & self , src : & Path , dst : & Path , filter : & dyn Fn ( & Path ) -> bool ) {
1548
1548
// Immediately recurse with an empty relative path
1549
- self . recurse_ ( src, dst, Path :: new ( "" ) , filter, true )
1549
+ self . recurse_ ( src, dst, Path :: new ( "" ) , filter)
1550
1550
}
1551
1551
1552
1552
// Inner function does the actual work
1553
1553
//
1554
1554
// 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 ) {
1563
1556
for f in self . read_dir ( src) {
1564
1557
let path = f. path ( ) ;
1565
1558
let name = path. file_name ( ) . unwrap ( ) ;
@@ -1568,11 +1561,8 @@ impl Build {
1568
1561
// Only copy file or directory if the filter function returns true
1569
1562
if filter ( & relative) {
1570
1563
if t ! ( f. file_type( ) ) . is_dir ( ) {
1571
- if remove_dst_dir {
1572
- let _ = fs:: remove_dir_all ( & dst) ;
1573
- }
1574
1564
self . create_dir ( & dst) ;
1575
- self . recurse_ ( & path, & dst, & relative, filter, remove_dst_dir ) ;
1565
+ self . recurse_ ( & path, & dst, & relative, filter) ;
1576
1566
} else {
1577
1567
let _ = fs:: remove_file ( & dst) ;
1578
1568
self . copy ( & path, & dst) ;
0 commit comments