about summary refs log tree commit diff
diff options
context:
space:
mode:
authorest31 <MTest31@outlook.com>2017-06-17 21:54:09 +0200
committerest31 <MTest31@outlook.com>2017-06-18 23:26:39 +0200
commit696085faeef883bce7201ecf5ef95e8f11ad1f77 (patch)
tree63eea96b4a029188e29f28a57fa3bd818cdfaafb
parent9f6fb8e88f5983d882deb85c7820021a014d11b9 (diff)
Sort entries of SUMMARY.md alphabetically
-rw-r--r--src/tools/tidy/src/unstable_book.rs10
-rw-r--r--src/tools/unstable-book-gen/src/main.rs18
2 files changed, 14 insertions, 14 deletions
diff --git a/src/tools/tidy/src/unstable_book.rs b/src/tools/tidy/src/unstable_book.rs
index c8bfe42aa03..ff032b14ad1 100644
--- a/src/tools/tidy/src/unstable_book.rs
+++ b/src/tools/tidy/src/unstable_book.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-use std::collections::HashSet;
+use std::collections::BTreeSet;
 use std::fs;
 use std::path;
 use features::{collect_lang_features, collect_lib_features, Features, Status};
@@ -45,7 +45,7 @@ fn dir_entry_is_file(dir_entry: &fs::DirEntry) -> bool {
 }
 
 /// Retrieve names of all unstable features
-pub fn collect_unstable_feature_names(features: &Features) -> HashSet<String> {
+pub fn collect_unstable_feature_names(features: &Features) -> BTreeSet<String> {
     features
         .iter()
         .filter(|&(_, ref f)| f.level == Status::Unstable)
@@ -53,7 +53,7 @@ pub fn collect_unstable_feature_names(features: &Features) -> HashSet<String> {
         .collect()
 }
 
-pub fn collect_unstable_book_section_file_names(dir: &path::Path) -> HashSet<String> {
+pub fn collect_unstable_book_section_file_names(dir: &path::Path) -> BTreeSet<String> {
     fs::read_dir(dir)
         .expect("could not read directory")
         .into_iter()
@@ -69,7 +69,7 @@ pub fn collect_unstable_book_section_file_names(dir: &path::Path) -> HashSet<Str
 /// * hyphens replaced by underscores
 /// * the markdown suffix ('.md') removed
 fn collect_unstable_book_lang_features_section_file_names(base_src_path: &path::Path)
-                                                          -> HashSet<String> {
+                                                          -> BTreeSet<String> {
     collect_unstable_book_section_file_names(&unstable_book_lang_features_path(base_src_path))
 }
 
@@ -78,7 +78,7 @@ fn collect_unstable_book_lang_features_section_file_names(base_src_path: &path::
 /// * hyphens replaced by underscores
 /// * the markdown suffix ('.md') removed
 fn collect_unstable_book_lib_features_section_file_names(base_src_path: &path::Path)
-                                                         -> HashSet<String> {
+                                                         -> BTreeSet<String> {
     collect_unstable_book_section_file_names(&unstable_book_lib_features_path(base_src_path))
 }
 
diff --git a/src/tools/unstable-book-gen/src/main.rs b/src/tools/unstable-book-gen/src/main.rs
index 71063968ff2..5c2bd1e3e08 100644
--- a/src/tools/unstable-book-gen/src/main.rs
+++ b/src/tools/unstable-book-gen/src/main.rs
@@ -17,7 +17,7 @@ extern crate tidy;
 use tidy::features::{Feature, Features, collect_lib_features, collect_lang_features};
 use tidy::unstable_book::{collect_unstable_feature_names, collect_unstable_book_section_file_names,
                           PATH_STR, LANG_FEATURES_DIR, LIB_FEATURES_DIR};
-use std::collections::HashSet;
+use std::collections::BTreeSet;
 use std::io::Write;
 use std::fs::{self, File};
 use std::env;
@@ -48,9 +48,9 @@ fn generate_stub_no_issue(path: &Path, name: &str) {
                                    name = name)));
 }
 
-fn hset_to_summary_str(hset: HashSet<String>, dir: &str
+fn set_to_summary_str(set: &BTreeSet<String>, dir: &str
 ) -> String {
-    hset
+    set
         .iter()
         .map(|ref n| format!("    - [{}]({}/{}.md)",
                                       n,
@@ -63,16 +63,16 @@ fn generate_summary(path: &Path, lang_features: &Features, lib_features: &Featur
     let compiler_flags = collect_unstable_book_section_file_names(
         &path.join("compiler-flags"));
 
-    let compiler_flags_str = hset_to_summary_str(compiler_flags,
-                                                 "compiler-flags");
+    let compiler_flags_str = set_to_summary_str(&compiler_flags,
+                                                "compiler-flags");
 
     let unstable_lang_features = collect_unstable_feature_names(&lang_features);
     let unstable_lib_features = collect_unstable_feature_names(&lib_features);
 
-    let lang_features_str = hset_to_summary_str(unstable_lang_features,
-                                                LANG_FEATURES_DIR);
-    let lib_features_str = hset_to_summary_str(unstable_lib_features,
-                                               LIB_FEATURES_DIR);
+    let lang_features_str = set_to_summary_str(&unstable_lang_features,
+                                               LANG_FEATURES_DIR);
+    let lib_features_str = set_to_summary_str(&unstable_lib_features,
+                                              LIB_FEATURES_DIR);
 
     let mut file = t!(File::create(&path.join("SUMMARY.md")));
     t!(file.write_fmt(format_args!(include_str!("SUMMARY.md"),