Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 0 additions & 26 deletions src/doc/unstable-book/src/library-features/c-variadic.md

This file was deleted.

29 changes: 21 additions & 8 deletions src/tools/tidy/src/unstable_book.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,19 @@ fn collect_unstable_book_lib_features_section_file_names(base_src_path: &Path) -
collect_unstable_book_section_file_names(&unstable_book_lib_features_path(base_src_path))
}

/// Would switching underscores for dashes work?
fn maybe_suggest_dashes(names: &BTreeSet<String>, feature_name: &str, bad: &mut bool) {
let with_dashes = feature_name.replace('_', "-");
if names.contains(&with_dashes) {
tidy_error!(
bad,
"the file `{}.md` contains underscores; use dashes instead: `{}.md`",
feature_name,
with_dashes,
);
}
}

pub fn check(path: &Path, features: CollectedFeatures, bad: &mut bool) {
let lang_features = features.lang;
let lib_features = features
Expand All @@ -93,14 +106,13 @@ pub fn check(path: &Path, features: CollectedFeatures, bad: &mut bool) {
// Check for Unstable Book sections that don't have a corresponding unstable feature
for feature_name in &unstable_book_lib_features_section_file_names - &unstable_lib_feature_names
{
if !unstable_lang_feature_names.contains(&feature_name) {
tidy_error!(
bad,
"The Unstable Book has a 'library feature' section '{}' which doesn't \
tidy_error!(
bad,
"The Unstable Book has a 'library feature' section '{}' which doesn't \
correspond to an unstable library feature",
feature_name
);
}
feature_name
);
maybe_suggest_dashes(&unstable_lib_feature_names, &feature_name, bad);
}

// Check for Unstable Book sections that don't have a corresponding unstable feature.
Expand All @@ -112,7 +124,8 @@ pub fn check(path: &Path, features: CollectedFeatures, bad: &mut bool) {
"The Unstable Book has a 'language feature' section '{}' which doesn't \
correspond to an unstable language feature",
feature_name
)
);
maybe_suggest_dashes(&unstable_lang_feature_names, &feature_name, bad);
}

// List unstable features that don't have Unstable Book sections.
Expand Down
Loading