@@ -4,7 +4,6 @@ use std::{
44 collections:: BTreeMap ,
55 fmt:: Write ,
66 io:: { BufRead , BufReader } ,
7- path:: Path ,
87 time:: SystemTime ,
98} ;
109
@@ -128,61 +127,6 @@ impl Blacksmith {
128127 Ok ( blacksmith)
129128 }
130129
131- fn generate_redirects ( & self , ctx : & PreprocessorContext ) {
132- if ctx. renderer != "html" {
133- return ;
134- }
135-
136- let dir = ctx. config . build . build_dir . as_path ( ) ;
137-
138- /// A list of pairs of file names and where to redirect to from their
139- /// page.
140- #[ rustfmt:: skip]
141- const REDIRECTS : & [ ( & str , & str ) ] = & [
142- ( "beta-backporting.html" , "/release/beta-backporting.html" ) ,
143- ( "bibliography.html" , "https://rustc-dev-guide.rust-lang.org/appendix/bibliography.html" ) ,
144- ( "channel-layout.html" , "/infra/channel-layout.html" ) ,
145- ( "debugging.html" , "https://rustc-dev-guide.rust-lang.org/compiler-debugging.html" ) ,
146- ( "feature_guide.html" , "https://rustc-dev-guide.rust-lang.org/implementing_new_features.html" ) ,
147- ( "fott.html" , "/archive/fott.html" ) ,
148- ( "infrastructure.html" , "/infra/service-infrastructure.html" ) ,
149- ( "other-installation-methods.html" , "/infra/other-installation-methods.html" ) ,
150- ( "platform-support.html" , "/release/platform-support.html" ) ,
151- ( "profile-queries.html" , "/compiler/profile-queries.html" ) ,
152- ( "release-notes.html" , "/release/release-notes.html" ) ,
153- ( "releases.html" , "/archive/release-history.html" ) ,
154- ( "rfc-merge-procedure.html" , "/lang/rfc-merge-procedure.html" ) ,
155- ( "rustc-bug-fix-procedure.html" , "/compiler/bug-fix-procedure.html" ) ,
156- ( "rustc-diagnostic-code.html" , "/compiler/diagnostic-codes.html" ) ,
157- ( "rustc-team-maintenance.html" , "/infra/team-maintenance.html" ) ,
158- ( "stabilization-guide.html" , "https://rustc-dev-guide.rust-lang.org/stabilization_guide.html" ) ,
159- ( "state-of-rust.html" , "https://github.com/rust-lang/rust/projects/8" ) ,
160- ( "test-suite.html" , "https://rustc-dev-guide.rust-lang.org/tests/intro.html" ) ,
161- ( "toolstate.html" , "/infra/toolstate.html" ) ,
162- ( "triage-procedure.html" , "/release/triage-procedure.html" ) ,
163- ( "x-py.html" , "https://rustc-dev-guide.rust-lang.org/building/how-to-build-and-run.html" ) ,
164- ( "compiler/bug-fix-procedure.html" , "https://rustc-dev-guide.rust-lang.org/bug-fix-procedure.html" ) ,
165- ( "compiler/diagnostic-codes.html" , "https://rustc-dev-guide.rust-lang.org/diagnostics/diagnostic-codes.html" ) ,
166- ( "compiler/profile-queries.html" , "https://rustc-dev-guide.rust-lang.org/queries/profiling.html" ) ,
167- ] ;
168-
169- // Inititalise book directory if not built yet.
170- std:: fs:: create_dir_all ( dir) . unwrap ( ) ;
171-
172- log:: info!( "Generating {} redirect pages." , REDIRECTS . len( ) ) ;
173- for ( filename, url) in REDIRECTS {
174- let template = include_str ! ( "../redirect.html" ) . replace ( "{{url}}" , url) ;
175-
176- log:: trace!( "Redirecting {} to {}." , filename, url) ;
177-
178- if let Some ( parent) = Path :: new ( filename) . parent ( ) {
179- std:: fs:: create_dir_all ( dir. join ( parent) ) . unwrap ( ) ;
180- }
181-
182- std:: fs:: write ( dir. join ( filename) , template) . unwrap ( ) ;
183- }
184- }
185-
186130 /// Creates a list of hyperlinks to `rustup-init` based on what targets
187131 /// rustup provided using the following URL schema. Where `target` is the
188132 /// platforms target tuple (`x86_64-apple-darwin`) and `suffix` is a target
@@ -328,7 +272,7 @@ impl Preprocessor for Blacksmith {
328272 "blacksmith"
329273 }
330274
331- fn run ( & self , ctx : & PreprocessorContext , mut book : Book ) -> Result < Book , Error > {
275+ fn run ( & self , _ : & PreprocessorContext , mut book : Book ) -> Result < Book , Error > {
332276 fn recursive_replace ( book_item : & mut BookItem , old : & str , new : & str ) {
333277 let chapter = match book_item {
334278 BookItem :: Chapter ( chapter) => chapter,
@@ -357,8 +301,6 @@ impl Preprocessor for Blacksmith {
357301 recursive_replace ( item, "{{#source_code_table}}" , & source_code_table) ;
358302 }
359303
360- self . generate_redirects ( ctx) ;
361-
362304 Ok ( book)
363305 }
364306
0 commit comments