@@ -72,6 +72,19 @@ fn collect_unstable_book_lib_features_section_file_names(base_src_path: &Path) -
72
72
collect_unstable_book_section_file_names ( & unstable_book_lib_features_path ( base_src_path) )
73
73
}
74
74
75
+ /// Would switching underscores for dashes work?
76
+ fn maybe_suggest_dashes ( names : & BTreeSet < String > , feature_name : & str , bad : & mut bool ) {
77
+ let with_dashes = feature_name. replace ( '_' , "-" ) ;
78
+ if names. contains ( & with_dashes) {
79
+ tidy_error ! (
80
+ bad,
81
+ "the file `{}.md` contains underscores; use dashes instead: `{}.md`" ,
82
+ feature_name,
83
+ with_dashes,
84
+ ) ;
85
+ }
86
+ }
87
+
75
88
pub fn check ( path : & Path , features : CollectedFeatures , bad : & mut bool ) {
76
89
let lang_features = features. lang ;
77
90
let lib_features = features
@@ -99,6 +112,7 @@ pub fn check(path: &Path, features: CollectedFeatures, bad: &mut bool) {
99
112
correspond to an unstable library feature",
100
113
feature_name
101
114
) ;
115
+ maybe_suggest_dashes ( & unstable_lib_feature_names, & feature_name, bad) ;
102
116
}
103
117
104
118
// Check for Unstable Book sections that don't have a corresponding unstable feature.
@@ -110,7 +124,8 @@ pub fn check(path: &Path, features: CollectedFeatures, bad: &mut bool) {
110
124
"The Unstable Book has a 'language feature' section '{}' which doesn't \
111
125
correspond to an unstable language feature",
112
126
feature_name
113
- )
127
+ ) ;
128
+ maybe_suggest_dashes ( & unstable_lang_feature_names, & feature_name, bad) ;
114
129
}
115
130
116
131
// List unstable features that don't have Unstable Book sections.
0 commit comments