Skip to content

Commit

Permalink
Exit early from feature search if no features in file
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark-Simulacrum committed Jun 23, 2019
1 parent 6c5c78d commit 777951c
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/tools/tidy/src/features.rs
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,15 @@ fn map_lib_features(base_src_path: &Path,
return;
}

let mut becoming_feature: Option<(String, Feature)> = None;
// This is an early exit -- all the attributes we're concerned with must contain this:
// * rustc_const_unstable(
// * unstable(
// * stable(
if !contents.contains("stable(") {
return;
}

let mut becoming_feature: Option<(&str, Feature)> = None;
for (i, line) in contents.lines().enumerate() {
macro_rules! err {
($msg:expr) => {{
Expand Down Expand Up @@ -457,7 +465,7 @@ fn map_lib_features(base_src_path: &Path,
if line.contains(']') {
mf(Ok((feature_name, feature)), file, i + 1);
} else {
becoming_feature = Some((feature_name.to_owned(), feature));
becoming_feature = Some((feature_name, feature));
}
}
});
Expand Down

0 comments on commit 777951c

Please sign in to comment.