Skip to content

Commit cd56472

Browse files
committed
Fix tidy check for language and library features
1 parent 4855370 commit cd56472

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

src/tools/tidy/src/unstable_book.rs

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -82,25 +82,27 @@ pub fn check(path: &path::Path, bad: &mut bool) {
8282
!lang_features.contains_key(name)
8383
}).collect();
8484

85+
// Library features
8586
let unstable_lib_feature_names = collect_unstable_feature_names(&lib_features);
8687
let unstable_book_lib_features_section_file_names =
8788
collect_unstable_book_lib_features_section_file_names(path);
8889

89-
// Check for Unstable Book sections that don't have a corresponding unstable feature
90-
for feature_name in &unstable_book_lib_features_section_file_names -
91-
&unstable_lib_feature_names {
92-
tidy_error!(bad,
93-
"The Unstable Book has a 'library feature' section '{}' which doesn't \
94-
correspond to an unstable library feature",
95-
feature_name)
96-
}
97-
9890
// Language features
99-
10091
let unstable_lang_feature_names = collect_unstable_feature_names(&lang_features);
10192
let unstable_book_lang_features_section_file_names =
10293
collect_unstable_book_lang_features_section_file_names(path);
10394

95+
// Check for Unstable Book sections that don't have a corresponding unstable feature
96+
for feature_name in &unstable_book_lib_features_section_file_names -
97+
&unstable_lib_feature_names {
98+
if !unstable_lang_feature_names.contains(&feature_name) {
99+
tidy_error!(bad,
100+
"The Unstable Book has a 'library feature' section '{}' which doesn't \
101+
correspond to an unstable library feature",
102+
feature_name);
103+
}
104+
}
105+
104106
// Check for Unstable Book sections that don't have a corresponding unstable feature.
105107
for feature_name in &unstable_book_lang_features_section_file_names -
106108
&unstable_lang_feature_names {

0 commit comments

Comments
 (0)