Skip to content

Commit 57b460d

Browse files
committed
index/features: Extract has_features2_syntax() fn
1 parent 2eec9bb commit 57b460d

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

crates/crates_io_index/features.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,7 @@ pub fn split_features(
1717
features
1818
.into_iter()
1919
.partition::<FeaturesMap, _>(|(_k, vals)| {
20-
!vals
21-
.iter()
22-
.any(|v| v.starts_with("dep:") || v.contains("?/"))
20+
!vals.iter().map(String::as_ref).any(has_features2_syntax)
2321
});
2422

2523
// Then, we recursively move features from `features` to `features2` if they
@@ -47,6 +45,10 @@ pub fn split_features(
4745
(features, features2)
4846
}
4947

48+
fn has_features2_syntax(s: &str) -> bool {
49+
s.starts_with("dep:") || s.contains("?/")
50+
}
51+
5052
#[cfg(test)]
5153
mod tests {
5254
use super::*;

0 commit comments

Comments
 (0)