1
1
mod channel;
2
2
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 } ;
9
4
10
5
use mdbook:: {
11
6
book:: { Book , BookItem } ,
@@ -16,8 +11,6 @@ use mdbook::{
16
11
const CHANNELS : & [ & str ] = & [ "stable" , "beta" , "nightly" ] ;
17
12
const CHANNEL_URL_PREFIX : & str = "https://static.rust-lang.org/dist/channel-rust-" ;
18
13
const 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" ;
21
14
22
15
/// A representation of a rust target platform. `stable`, `beta`, and `nightly`
23
16
/// represent whether the platform is available on that channel. `stable` also
@@ -43,7 +36,6 @@ impl Default for Platform {
43
36
#[ derive( Default , serde:: Serialize , serde:: Deserialize ) ]
44
37
pub struct Blacksmith {
45
38
last_update : Option < u64 > ,
46
- rustup : Vec < String > ,
47
39
stable_version : Option < String > ,
48
40
platforms : BTreeMap < String , Platform > ,
49
41
#[ serde( default ) ]
@@ -70,17 +62,6 @@ impl Blacksmith {
70
62
pub fn init ( ) -> Result < Self , Box < dyn std:: error:: Error > > {
71
63
let mut blacksmith = Self :: new ( ) ;
72
64
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
-
84
65
for & channel_name in CHANNELS {
85
66
let channel_url = format ! ( "{}{}.toml" , CHANNEL_URL_PREFIX , channel_name) ;
86
67
let content = reqwest:: blocking:: get ( & channel_url) ?. text ( ) ?;
@@ -264,34 +245,6 @@ impl Blacksmith {
264
245
Ok ( blacksmith)
265
246
}
266
247
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
-
295
248
/// Generates a table of links to the standalone installer packages for
296
249
/// each platform.
297
250
fn generate_standalone_installers_table ( & self ) -> String {
@@ -469,7 +422,6 @@ impl Preprocessor for Blacksmith {
469
422
}
470
423
}
471
424
472
- let rustup_init_list = self . generate_rustup_init_list ( ) ;
473
425
let standalone_installers_table = self . generate_standalone_installers_table ( ) ;
474
426
let previous_stable_standalone_installers_tables =
475
427
self . generate_previous_stable_standalone_installers_tables ( ) ;
@@ -481,7 +433,6 @@ impl Preprocessor for Blacksmith {
481
433
// However if the processing time begins to become a bottleneck this
482
434
// should change.
483
435
for item in & mut book. sections {
484
- recursive_replace ( item, "{{#rustup_init_list}}" , & rustup_init_list) ;
485
436
recursive_replace ( item, "{{#installer_table}}" , & standalone_installers_table) ;
486
437
recursive_replace (
487
438
item,
0 commit comments