Skip to content

Commit

Permalink
Auto merge of #42722 - est31:master, r=Mark-Simulacrum
Browse files Browse the repository at this point in the history
Remove SUMMARY.md of the unstable book as its autogenerated

Its being autogenerated now, as of PR #42612.
It seems I forgot to remove it.

Also, sort the entries of SUMMARY.md alphabetically.
  • Loading branch information
bors committed Jun 19, 2017
2 parents 8e26c0e + 696085f commit 8525eb8
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 239 deletions.
225 changes: 0 additions & 225 deletions src/doc/unstable-book/src/SUMMARY.md

This file was deleted.

10 changes: 5 additions & 5 deletions src/tools/tidy/src/unstable_book.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down Expand Up @@ -45,15 +45,15 @@ 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)
.map(|(name, _)| name.to_owned())
.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()
Expand All @@ -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))
}

Expand All @@ -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))
}

Expand Down
18 changes: 9 additions & 9 deletions src/tools/unstable-book-gen/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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,
Expand All @@ -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"),
Expand Down

0 comments on commit 8525eb8

Please sign in to comment.