diff --git a/src/tools/tidy/src/unstable_book.rs b/src/tools/tidy/src/unstable_book.rs index c8bfe42aa03df..ff032b14ad1d5 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 { +pub fn collect_unstable_feature_names(features: &Features) -> BTreeSet { features .iter() .filter(|&(_, ref f)| f.level == Status::Unstable) @@ -53,7 +53,7 @@ pub fn collect_unstable_feature_names(features: &Features) -> HashSet { .collect() } -pub fn collect_unstable_book_section_file_names(dir: &path::Path) -> HashSet { +pub fn collect_unstable_book_section_file_names(dir: &path::Path) -> BTreeSet { 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 HashSet { + -> BTreeSet { 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 { + -> BTreeSet { 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 71063968ff2c0..5c2bd1e3e087d 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, dir: &str +fn set_to_summary_str(set: &BTreeSet, 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"),