@@ -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
}
@@ -516,7 +502,7 @@ impl Step for Std {
516
502
for requested_crate in requested_crates {
517
503
if STD_PUBLIC_CRATES . iter ( ) . any ( |k| * k == requested_crate. as_str ( ) ) {
518
504
let index = out. join ( requested_crate) . join ( "index.html" ) ;
519
- open ( builder, & index) ;
505
+ builder. open_in_browser ( index) ;
520
506
}
521
507
}
522
508
}
@@ -736,7 +722,7 @@ impl Step for Rustc {
736
722
// Let's open the first crate documentation page:
737
723
if let Some ( krate) = to_open {
738
724
let index = out. join ( krate) . join ( "index.html" ) ;
739
- open ( builder, & index) ;
725
+ builder. open_in_browser ( index) ;
740
726
}
741
727
}
742
728
}
@@ -996,10 +982,9 @@ impl Step for RustcBook {
996
982
name : INTERNER . intern_str ( "rustc" ) ,
997
983
src : INTERNER . intern_path ( out_base) ,
998
984
} ) ;
999
- if builder. was_invoked_explicitly :: < Self > ( Kind :: Doc ) {
1000
- let out = builder. doc_out ( self . target ) ;
1001
- let index = out. join ( "rustc" ) . join ( "index.html" ) ;
1002
- open ( builder, & index) ;
1003
- }
985
+
986
+ let out = builder. doc_out ( self . target ) ;
987
+ let index = out. join ( "rustc" ) . join ( "index.html" ) ;
988
+ builder. maybe_open_in_browser :: < Self > ( index) ;
1004
989
}
1005
990
}
0 commit comments