@@ -148,6 +148,8 @@ struct SharedContext {
148
148
/// If false, the `select` element to have search filtering by crates on rendered docs
149
149
/// won't be generated.
150
150
pub generate_search_filter : bool ,
151
+ /// Option disabled by default to generate files used by RLS and some other tools.
152
+ pub generate_redirect_pages : bool ,
151
153
}
152
154
153
155
impl SharedContext {
@@ -516,6 +518,7 @@ pub fn run(mut krate: clean::Crate,
516
518
resource_suffix,
517
519
static_root_path,
518
520
generate_search_filter,
521
+ generate_redirect_pages,
519
522
..
520
523
} = options;
521
524
@@ -545,6 +548,7 @@ pub fn run(mut krate: clean::Crate,
545
548
resource_suffix,
546
549
static_root_path,
547
550
generate_search_filter,
551
+ generate_redirect_pages,
548
552
} ;
549
553
550
554
// If user passed in `--playground-url` arg, we fill in crate name here
@@ -2246,17 +2250,18 @@ impl Context {
2246
2250
if !self . render_redirect_pages {
2247
2251
all. append ( full_path ( self , & item) , & item_type) ;
2248
2252
}
2249
- // Redirect from a sane URL using the namespace to Rustdoc's
2250
- // URL for the page.
2251
- let redir_name = format ! ( "{}.{}.html" , name, item_type. name_space( ) ) ;
2252
- let redir_dst = self . dst . join ( redir_name) ;
2253
- if let Ok ( redirect_out) = OpenOptions :: new ( ) . create_new ( true )
2254
- . write ( true )
2255
- . open ( & redir_dst) {
2256
- let mut redirect_out = BufWriter :: new ( redirect_out) ;
2257
- try_err ! ( layout:: redirect( & mut redirect_out, file_name) , & redir_dst) ;
2253
+ if self . shared . generate_redirect_pages {
2254
+ // Redirect from a sane URL using the namespace to Rustdoc's
2255
+ // URL for the page.
2256
+ let redir_name = format ! ( "{}.{}.html" , name, item_type. name_space( ) ) ;
2257
+ let redir_dst = self . dst . join ( redir_name) ;
2258
+ if let Ok ( redirect_out) = OpenOptions :: new ( ) . create_new ( true )
2259
+ . write ( true )
2260
+ . open ( & redir_dst) {
2261
+ let mut redirect_out = BufWriter :: new ( redirect_out) ;
2262
+ try_err ! ( layout:: redirect( & mut redirect_out, file_name) , & redir_dst) ;
2263
+ }
2258
2264
}
2259
-
2260
2265
// If the item is a macro, redirect from the old macro URL (with !)
2261
2266
// to the new one (without).
2262
2267
if item_type == ItemType :: Macro {
0 commit comments