@@ -2390,22 +2390,39 @@ impl<'test> TestCx<'test> {
23902390 proc_res. fatal ( Some ( "failed to run nightly rustdoc" ) , || ( ) ) ;
23912391 }
23922392
2393- // NOTE: this is fine since compiletest never runs out-of-tree
2394- let tidy = concat ! ( env!( "CARGO_MANIFEST_DIR" ) , "/tidy-rustdoc.sh" ) ;
2395- // FIXME: this overwrites `out_dir` in place, maybe we should make a copy?
2396- let status = Command :: new ( tidy)
2397- . arg ( out_dir)
2398- . spawn ( )
2399- . expect ( "tidy-rustdoc not found" )
2400- . wait ( )
2401- . unwrap ( ) ;
2402- if !status. success ( ) {
2403- self . fatal ( "failed to run tidy - is it installed?" ) ;
2404- }
2405- let status = Command :: new ( tidy) . arg ( & compare_dir) . spawn ( ) . unwrap ( ) . wait ( ) . unwrap ( ) ;
2406- if !status. success ( ) {
2407- self . fatal ( "failed to run tidy" ) ;
2408- }
2393+ #[ rustfmt:: skip]
2394+ let tidy_args = [
2395+ "--indent" , "yes" ,
2396+ "--indent-spaces" , "2" ,
2397+ "--wrap" , "0" ,
2398+ "--show-warnings" , "no" ,
2399+ "--markup" , "yes" ,
2400+ "--quiet" , "yes" ,
2401+ "-modify" ,
2402+ ] ;
2403+ let tidy_dir = |dir| {
2404+ let tidy = |file : & _ | {
2405+ Command :: new ( "tidy" )
2406+ . args ( & tidy_args)
2407+ . arg ( file)
2408+ . spawn ( )
2409+ . unwrap_or_else ( |err| {
2410+ self . fatal ( & format ! ( "failed to run tidy - is it installed? - {}" , err) )
2411+ } )
2412+ . wait ( )
2413+ . unwrap ( )
2414+ } ;
2415+ for entry in walkdir:: WalkDir :: new ( dir) {
2416+ let entry = entry. expect ( "failed to read file" ) ;
2417+ if entry. file_type ( ) . is_file ( )
2418+ && entry. path ( ) . extension ( ) . and_then ( |p| p. to_str ( ) ) == Some ( "html" . into ( ) )
2419+ {
2420+ tidy ( entry. path ( ) ) ;
2421+ }
2422+ }
2423+ } ;
2424+ tidy_dir ( out_dir) ;
2425+ tidy_dir ( & compare_dir) ;
24092426
24102427 let pager = {
24112428 let output = Command :: new ( "git" ) . args ( & [ "config" , "--get" , "core.pager" ] ) . output ( ) . ok ( ) ;
0 commit comments