@@ -85,18 +85,6 @@ book!(
85
85
StyleGuide , "src/doc/style-guide" , "style-guide" ;
86
86
) ;
87
87
88
- fn open ( builder : & Builder < ' _ > , path : impl AsRef < Path > ) {
89
- if builder. config . dry_run || !builder. config . cmd . open ( ) {
90
- return ;
91
- }
92
-
93
- let path = path. as_ref ( ) ;
94
- builder. info ( & format ! ( "Opening doc {}" , path. display( ) ) ) ;
95
- if let Err ( err) = opener:: open ( path) {
96
- builder. info ( & format ! ( "{}\n " , err) ) ;
97
- }
98
- }
99
-
100
88
// "library/std" -> ["library", "std"]
101
89
//
102
90
// Used for deciding whether a particular step is one requested by the user on
@@ -240,11 +228,9 @@ impl Step for TheBook {
240
228
invoke_rustdoc ( builder, compiler, & shared_assets, target, path) ;
241
229
}
242
230
243
- if builder. was_invoked_explicitly :: < Self > ( Kind :: Doc ) {
244
- let out = builder. doc_out ( target) ;
245
- let index = out. join ( "book" ) . join ( "index.html" ) ;
246
- open ( builder, & index) ;
247
- }
231
+ let out = builder. doc_out ( target) ;
232
+ let index = out. join ( "book" ) . join ( "index.html" ) ;
233
+ builder. maybe_open_in_browser :: < Self > ( index) ;
248
234
}
249
235
}
250
236
@@ -386,7 +372,7 @@ impl Step for Standalone {
386
372
// with no particular explicit doc requested (e.g. library/core).
387
373
if builder. paths . is_empty ( ) || builder. was_invoked_explicitly :: < Self > ( Kind :: Doc ) {
388
374
let index = out. join ( "index.html" ) ;
389
- open ( builder, & index) ;
375
+ builder. open_in_browser ( & index) ;
390
376
}
391
377
}
392
378
}
@@ -507,7 +493,7 @@ impl Step for Std {
507
493
for requested_crate in requested_crates {
508
494
if STD_PUBLIC_CRATES . iter ( ) . any ( |k| * k == requested_crate. as_str ( ) ) {
509
495
let index = out. join ( requested_crate) . join ( "index.html" ) ;
510
- open ( builder, & index) ;
496
+ builder. open_in_browser ( index) ;
511
497
}
512
498
}
513
499
}
@@ -759,7 +745,7 @@ impl Step for Rustc {
759
745
// Let's open the first crate documentation page:
760
746
if let Some ( krate) = to_open {
761
747
let index = out. join ( krate) . join ( "index.html" ) ;
762
- open ( builder, & index) ;
748
+ builder. open_in_browser ( index) ;
763
749
}
764
750
}
765
751
}
@@ -1019,10 +1005,9 @@ impl Step for RustcBook {
1019
1005
name : INTERNER . intern_str ( "rustc" ) ,
1020
1006
src : INTERNER . intern_path ( out_base) ,
1021
1007
} ) ;
1022
- if builder. was_invoked_explicitly :: < Self > ( Kind :: Doc ) {
1023
- let out = builder. doc_out ( self . target ) ;
1024
- let index = out. join ( "rustc" ) . join ( "index.html" ) ;
1025
- open ( builder, & index) ;
1026
- }
1008
+
1009
+ let out = builder. doc_out ( self . target ) ;
1010
+ let index = out. join ( "rustc" ) . join ( "index.html" ) ;
1011
+ builder. maybe_open_in_browser :: < Self > ( index) ;
1027
1012
}
1028
1013
}
0 commit comments