@@ -492,7 +492,7 @@ pub fn run(mut krate: clean::Crate,
492
492
}
493
493
}
494
494
}
495
- try_err ! ( mkdir ( & dst) , & dst) ;
495
+ try_err ! ( fs :: create_dir_all ( & dst) , & dst) ;
496
496
krate = render_sources ( & dst, & mut scx, krate) ?;
497
497
let cx = Context {
498
498
current : Vec :: new ( ) ,
@@ -658,7 +658,7 @@ fn write_shared(cx: &Context,
658
658
// Write out the shared files. Note that these are shared among all rustdoc
659
659
// docs placed in the output directory, so this needs to be a synchronized
660
660
// operation with respect to all other rustdocs running around.
661
- try_err ! ( mkdir ( & cx. dst) , & cx. dst) ;
661
+ try_err ! ( fs :: create_dir_all ( & cx. dst) , & cx. dst) ;
662
662
let _lock = flock:: Lock :: panicking_new ( & cx. dst . join ( ".lock" ) , true , true , true ) ;
663
663
664
664
// Add all the static files. These may already exist, but we just
@@ -808,10 +808,8 @@ fn write_shared(cx: &Context,
808
808
fn render_sources ( dst : & Path , scx : & mut SharedContext ,
809
809
krate : clean:: Crate ) -> Result < clean:: Crate , Error > {
810
810
info ! ( "emitting source files" ) ;
811
- let dst = dst. join ( "src" ) ;
812
- try_err ! ( mkdir( & dst) , & dst) ;
813
- let dst = dst. join ( & krate. name ) ;
814
- try_err ! ( mkdir( & dst) , & dst) ;
811
+ let dst = dst. join ( "src" ) . join ( & krate. name ) ;
812
+ try_err ! ( fs:: create_dir_all( & dst) , & dst) ;
815
813
let mut folder = SourceCollector {
816
814
dst : dst,
817
815
scx : scx,
@@ -825,19 +823,6 @@ fn write(dst: PathBuf, contents: &[u8]) -> Result<(), Error> {
825
823
Ok ( try_err ! ( try_err!( File :: create( & dst) , & dst) . write_all( contents) , & dst) )
826
824
}
827
825
828
- /// Makes a directory on the filesystem, failing the thread if an error occurs
829
- /// and skipping if the directory already exists.
830
- ///
831
- /// Note that this also handles races as rustdoc is likely to be run
832
- /// concurrently against another invocation.
833
- fn mkdir ( path : & Path ) -> io:: Result < ( ) > {
834
- match fs:: create_dir ( path) {
835
- Ok ( ( ) ) => Ok ( ( ) ) ,
836
- Err ( ref e) if e. kind ( ) == io:: ErrorKind :: AlreadyExists => Ok ( ( ) ) ,
837
- Err ( e) => Err ( e)
838
- }
839
- }
840
-
841
826
/// Takes a path to a source file and cleans the path to it. This canonicalizes
842
827
/// things like ".." to components which preserve the "top down" hierarchy of a
843
828
/// static HTML tree. Each component in the cleaned path will be passed as an
@@ -951,7 +936,7 @@ impl<'a> SourceCollector<'a> {
951
936
let mut href = String :: new ( ) ;
952
937
clean_srcpath ( & self . scx . src_root , & p, false , |component| {
953
938
cur. push ( component) ;
954
- mkdir ( & cur) . unwrap ( ) ;
939
+ fs :: create_dir_all ( & cur) . unwrap ( ) ;
955
940
root_path. push_str ( "../" ) ;
956
941
href. push_str ( component) ;
957
942
href. push ( '/' ) ;
0 commit comments