Skip to content

Commit 4bcc828

Browse files
committed
Make in_feature_group a simple bool flag
1 parent c120fd8 commit 4bcc828

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

src/tools/tidy/src/features.rs

+6-7
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ use regex::{Regex, escape};
2020
mod version;
2121
use self::version::Version;
2222

23-
const FEATURE_GROUP_START_PREFIX: &str = "// feature-group-start:";
23+
const FEATURE_GROUP_START_PREFIX: &str = "// feature-group-start";
2424
const FEATURE_GROUP_END_PREFIX: &str = "// feature-group-end";
2525

2626
#[derive(Debug, PartialEq, Clone)]
@@ -194,7 +194,7 @@ pub fn collect_lang_features(base_src_path: &Path, bad: &mut bool) -> Features {
194194
// without one inside `// no tracking issue START` and `// no tracking issue END`.
195195
let mut next_feature_omits_tracking_issue = false;
196196

197-
let mut next_feature_group = None;
197+
let mut in_feature_group = false;
198198
let mut prev_since = None;
199199

200200
contents.lines().zip(1..)
@@ -215,7 +215,7 @@ pub fn collect_lang_features(base_src_path: &Path, bad: &mut bool) -> Features {
215215
}
216216

217217
if line.starts_with(FEATURE_GROUP_START_PREFIX) {
218-
if next_feature_group.is_some() {
218+
if in_feature_group {
219219
tidy_error!(
220220
bad,
221221
// ignore-tidy-linelength
@@ -224,12 +224,11 @@ pub fn collect_lang_features(base_src_path: &Path, bad: &mut bool) -> Features {
224224
);
225225
}
226226

227-
let group = line.trim_start_matches(FEATURE_GROUP_START_PREFIX).trim();
228-
next_feature_group = Some(group.to_owned());
227+
in_feature_group = true;
229228
prev_since = None;
230229
return None;
231230
} else if line.starts_with(FEATURE_GROUP_END_PREFIX) {
232-
next_feature_group = None;
231+
in_feature_group = false;
233232
prev_since = None;
234233
return None;
235234
}
@@ -257,7 +256,7 @@ pub fn collect_lang_features(base_src_path: &Path, bad: &mut bool) -> Features {
257256
None
258257
}
259258
};
260-
if next_feature_group.is_some() {
259+
if in_feature_group {
261260
if prev_since > since {
262261
tidy_error!(
263262
bad,

0 commit comments

Comments
 (0)