@@ -148,6 +148,8 @@ struct SharedContext {
148148 /// If false, the `select` element to have search filtering by crates on rendered docs
149149 /// won't be generated.
150150 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 ,
151153}
152154
153155impl SharedContext {
@@ -516,6 +518,7 @@ pub fn run(mut krate: clean::Crate,
516518 resource_suffix,
517519 static_root_path,
518520 generate_search_filter,
521+ generate_redirect_pages,
519522 ..
520523 } = options;
521524
@@ -545,6 +548,7 @@ pub fn run(mut krate: clean::Crate,
545548 resource_suffix,
546549 static_root_path,
547550 generate_search_filter,
551+ generate_redirect_pages,
548552 } ;
549553
550554 // If user passed in `--playground-url` arg, we fill in crate name here
@@ -2246,17 +2250,18 @@ impl Context {
22462250 if !self . render_redirect_pages {
22472251 all. append ( full_path ( self , & item) , & item_type) ;
22482252 }
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+ }
22582264 }
2259-
22602265 // If the item is a macro, redirect from the old macro URL (with !)
22612266 // to the new one (without).
22622267 if item_type == ItemType :: Macro {
0 commit comments