11mod channel;
22
3- use std:: {
4- collections:: BTreeMap ,
5- fmt:: Write ,
6- io:: { BufRead , BufReader } ,
7- time:: SystemTime ,
8- } ;
3+ use std:: { collections:: BTreeMap , fmt:: Write , time:: SystemTime } ;
94
105use mdbook:: {
116 book:: { Book , BookItem } ,
@@ -16,8 +11,6 @@ use mdbook::{
1611const CHANNELS : & [ & str ] = & [ "stable" , "beta" , "nightly" ] ;
1712const CHANNEL_URL_PREFIX : & str = "https://static.rust-lang.org/dist/channel-rust-" ;
1813const MANIFESTS_URL : & str = "https://static.rust-lang.org/manifests.txt" ;
19- const RUSTUP_URLS : & str =
20- "https://raw.githubusercontent.com/rust-lang/rustup.rs/stable/ci/cloudfront-invalidation.txt" ;
2114
2215/// A representation of a rust target platform. `stable`, `beta`, and `nightly`
2316/// represent whether the platform is available on that channel. `stable` also
@@ -43,7 +36,6 @@ impl Default for Platform {
4336#[ derive( Default , serde:: Serialize , serde:: Deserialize ) ]
4437pub struct Blacksmith {
4538 last_update : Option < u64 > ,
46- rustup : Vec < String > ,
4739 stable_version : Option < String > ,
4840 platforms : BTreeMap < String , Platform > ,
4941 #[ serde( default ) ]
@@ -70,17 +62,6 @@ impl Blacksmith {
7062 pub fn init ( ) -> Result < Self , Box < dyn std:: error:: Error > > {
7163 let mut blacksmith = Self :: new ( ) ;
7264
73- let rustup_url_regex =
74- regex:: Regex :: new ( r"^rustup/dist/([^/]+)/rustup-init(?:\.exe)?$" ) . unwrap ( ) ;
75- for line in BufReader :: new ( reqwest:: blocking:: get ( RUSTUP_URLS ) ?) . lines ( ) {
76- if let Some ( m) = rustup_url_regex. captures ( & ( line?) ) {
77- blacksmith
78- . rustup
79- . push ( m. get ( 1 ) . unwrap ( ) . as_str ( ) . to_string ( ) ) ;
80- }
81- }
82- log:: info!( "Found {} targets for rustup" , blacksmith. rustup. len( ) ) ;
83-
8465 for & channel_name in CHANNELS {
8566 let channel_url = format ! ( "{}{}.toml" , CHANNEL_URL_PREFIX , channel_name) ;
8667 let content = reqwest:: blocking:: get ( & channel_url) ?. text ( ) ?;
@@ -264,34 +245,6 @@ impl Blacksmith {
264245 Ok ( blacksmith)
265246 }
266247
267- /// Creates a list of hyperlinks to `rustup-init` based on what targets
268- /// rustup provided using the following URL schema. Where `target` is the
269- /// platforms target tuple (`x86_64-apple-darwin`) and `suffix` is a target
270- /// specific file extension.
271- /// ```url
272- /// https://static.rust-lang.org/rustup/dist/{target}/rustup-init{suffix}
273- /// ```
274- fn generate_rustup_init_list ( & self ) -> String {
275- let mut buffer = String :: new ( ) ;
276-
277- for target in & self . rustup {
278- let suffix = if target. contains ( "windows" ) {
279- ".exe"
280- } else {
281- ""
282- } ;
283-
284- writeln ! (
285- buffer,
286- "- [{target}](https://static.rust-lang.org/rustup/dist/{target}/rustup-init{suffix})" ,
287- target = target,
288- suffix = suffix,
289- ) . unwrap ( ) ;
290- }
291-
292- buffer
293- }
294-
295248 /// Generates a table of links to the standalone installer packages for
296249 /// each platform.
297250 fn generate_standalone_installers_table ( & self ) -> String {
@@ -469,7 +422,6 @@ impl Preprocessor for Blacksmith {
469422 }
470423 }
471424
472- let rustup_init_list = self . generate_rustup_init_list ( ) ;
473425 let standalone_installers_table = self . generate_standalone_installers_table ( ) ;
474426 let previous_stable_standalone_installers_tables =
475427 self . generate_previous_stable_standalone_installers_tables ( ) ;
@@ -481,7 +433,6 @@ impl Preprocessor for Blacksmith {
481433 // However if the processing time begins to become a bottleneck this
482434 // should change.
483435 for item in & mut book. sections {
484- recursive_replace ( item, "{{#rustup_init_list}}" , & rustup_init_list) ;
485436 recursive_replace ( item, "{{#installer_table}}" , & standalone_installers_table) ;
486437 recursive_replace (
487438 item,
0 commit comments