Skip to content

Commit 63f4285

Browse files
committed
Rollup merge of rust-lang#47414 - est31:master, r=alexcrichton
Enforce dashes in the unstable book file names Also rename the existing underscore using files to use dashes. Fixes rust-lang#47394.
2 parents f98a9a6 + 38e2667 commit 63f4285

File tree

6 files changed

+11
-8
lines changed

6 files changed

+11
-8
lines changed

src/tools/tidy/src/unstable_book.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ pub fn collect_unstable_feature_names(features: &Features) -> BTreeSet<String> {
4949
features
5050
.iter()
5151
.filter(|&(_, ref f)| f.level == Status::Unstable)
52-
.map(|(name, _)| name.to_owned())
52+
.map(|(name, _)| name.replace('_', "-"))
5353
.collect()
5454
}
5555

@@ -60,7 +60,7 @@ pub fn collect_unstable_book_section_file_names(dir: &path::Path) -> BTreeSet<St
6060
.map(|entry| entry.expect("could not read directory entry"))
6161
.filter(dir_entry_is_file)
6262
.map(|entry| entry.file_name().into_string().unwrap())
63-
.map(|n| n.trim_right_matches(".md").replace('-', "_"))
63+
.map(|n| n.trim_right_matches(".md").to_owned())
6464
.collect()
6565
}
6666

src/tools/unstable-book-gen/src/main.rs

+9-6
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,9 @@ fn set_to_summary_str(set: &BTreeSet<String>, dir: &str
5353
set
5454
.iter()
5555
.map(|ref n| format!(" - [{}]({}/{}.md)",
56-
n,
56+
n.replace('-', "_"),
5757
dir,
58-
n.replace('_', "-")))
58+
n))
5959
.fold("".to_owned(), |s, a| s + &a + "\n")
6060
}
6161

@@ -96,14 +96,17 @@ fn generate_unstable_book_files(src :&Path, out: &Path, features :&Features) {
9696
let unstable_section_file_names = collect_unstable_book_section_file_names(src);
9797
t!(fs::create_dir_all(&out));
9898
for feature_name in &unstable_features - &unstable_section_file_names {
99-
let file_name = format!("{}.md", feature_name.replace('_', "-"));
99+
let feature_name_underscore = feature_name.replace('-', "_");
100+
let file_name = format!("{}.md", feature_name);
100101
let out_file_path = out.join(&file_name);
101-
let feature = &features[&feature_name];
102+
let feature = &features[&feature_name_underscore];
102103

103104
if has_valid_tracking_issue(&feature) {
104-
generate_stub_issue(&out_file_path, &feature_name, feature.tracking_issue.unwrap());
105+
generate_stub_issue(&out_file_path,
106+
&feature_name_underscore,
107+
feature.tracking_issue.unwrap());
105108
} else {
106-
generate_stub_no_issue(&out_file_path, &feature_name);
109+
generate_stub_no_issue(&out_file_path, &feature_name_underscore);
107110
}
108111
}
109112
}

0 commit comments

Comments
 (0)