@@ -12,7 +12,6 @@ pub mod rustc;
1212pub  mod  rustdoc; 
1313
1414use  std:: env; 
15- use  std:: fs; 
1615use  std:: io; 
1716use  std:: path:: { Path ,  PathBuf } ; 
1817use  std:: process:: { Command ,  Output } ; 
@@ -35,10 +34,6 @@ pub fn tmp_dir() -> PathBuf {
3534    env:: var_os ( "TMPDIR" ) . unwrap ( ) . into ( ) 
3635} 
3736
38- pub  fn  tmp_path < P :  AsRef < Path > > ( path :  P )  -> PathBuf  { 
39-     tmp_dir ( ) . join ( path. as_ref ( ) ) 
40- } 
41- 
4237/// `TARGET` 
4338pub  fn  target ( )  -> String  { 
4439    env:: var ( "TARGET" ) . unwrap ( ) 
@@ -62,7 +57,7 @@ pub fn is_darwin() -> bool {
6257/// Construct a path to a static library under `$TMPDIR` given the library name. This will return a 
6358/// path with `$TMPDIR` joined with platform-and-compiler-specific library name. 
6459pub  fn  static_lib ( name :  & str )  -> PathBuf  { 
65-     tmp_path ( static_lib_name ( name) ) 
60+     tmp_dir ( ) . join ( static_lib_name ( name) ) 
6661} 
6762
6863pub  fn  python_command ( )  -> Command  { 
@@ -107,7 +102,7 @@ pub fn static_lib_name(name: &str) -> String {
107102/// Construct a path to a dynamic library under `$TMPDIR` given the library name. This will return a 
108103/// path with `$TMPDIR` joined with platform-and-compiler-specific library name. 
109104pub  fn  dynamic_lib ( name :  & str )  -> PathBuf  { 
110-     tmp_path ( dynamic_lib_name ( name) ) 
105+     tmp_dir ( ) . join ( dynamic_lib_name ( name) ) 
111106} 
112107
113108/// Construct the dynamic library name based on the platform. 
@@ -218,15 +213,15 @@ pub fn copy_dir_all(src: impl AsRef<Path>, dst: impl AsRef<Path>) {
218213    fn  copy_dir_all_inner ( src :  impl  AsRef < Path > ,  dst :  impl  AsRef < Path > )  -> io:: Result < ( ) >  { 
219214        let  dst = dst. as_ref ( ) ; 
220215        if  !dst. is_dir ( )  { 
221-             fs:: create_dir_all ( & dst) ?; 
216+             std :: fs:: create_dir_all ( & dst) ?; 
222217        } 
223-         for  entry in  fs:: read_dir ( src) ? { 
218+         for  entry in  std :: fs:: read_dir ( src) ? { 
224219            let  entry = entry?; 
225220            let  ty = entry. file_type ( ) ?; 
226221            if  ty. is_dir ( )  { 
227222                copy_dir_all_inner ( entry. path ( ) ,  dst. join ( entry. file_name ( ) ) ) ?; 
228223            }  else  { 
229-                 fs:: copy ( entry. path ( ) ,  dst. join ( entry. file_name ( ) ) ) ?; 
224+                 std :: fs:: copy ( entry. path ( ) ,  dst. join ( entry. file_name ( ) ) ) ?; 
230225            } 
231226        } 
232227        Ok ( ( ) ) 
@@ -245,15 +240,8 @@ pub fn copy_dir_all(src: impl AsRef<Path>, dst: impl AsRef<Path>) {
245240
246241/// Check that all files in `dir1` exist and have the same content in `dir2`. Panic otherwise. 
247242pub  fn  recursive_diff ( dir1 :  impl  AsRef < Path > ,  dir2 :  impl  AsRef < Path > )  { 
248-     fn  read_file ( path :  & Path )  -> Vec < u8 >  { 
249-         match  fs:: read ( path)  { 
250-             Ok ( c)  => c, 
251-             Err ( e)  => panic ! ( "Failed to read `{}`: {:?}" ,  path. display( ) ,  e) , 
252-         } 
253-     } 
254- 
255243    let  dir2 = dir2. as_ref ( ) ; 
256-     for  entry in  fs:: read_dir ( dir1) . unwrap ( )  { 
244+     for  entry in  fs:: read_dir ( dir1)  { 
257245        let  entry = entry. unwrap ( ) ; 
258246        let  entry_name = entry. file_name ( ) ; 
259247        let  path = entry. path ( ) ; 
@@ -262,8 +250,8 @@ pub fn recursive_diff(dir1: impl AsRef<Path>, dir2: impl AsRef<Path>) {
262250            recursive_diff ( & path,  & dir2. join ( entry_name) ) ; 
263251        }  else  { 
264252            let  path2 = dir2. join ( entry_name) ; 
265-             let  file1 = read_file ( & path) ; 
266-             let  file2 = read_file ( & path2) ; 
253+             let  file1 = fs :: read ( & path) ; 
254+             let  file2 = fs :: read ( & path2) ; 
267255
268256            // We don't use `assert_eq!` because they are `Vec<u8>`, so not great for display. 
269257            // Why not using String? Because there might be minified files or even potentially 
0 commit comments