Skip to content

Commit 97c9a17

Browse files
committed
refactor(toml): Inline TomlDetailedDependency::add_features
1 parent b4489e3 commit 97c9a17

File tree

1 file changed

+11
-15
lines changed

1 file changed

+11
-15
lines changed

src/cargo/util/toml/mod.rs

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1656,7 +1656,17 @@ impl schema::TomlInheritedDependency {
16561656
if let Some(public) = self.public {
16571657
d.public = Some(public);
16581658
}
1659-
d.add_features(self.features.clone());
1659+
d.features = match (d.features.clone(), self.features.clone()) {
1660+
(Some(dep_feat), Some(inherit_feat)) => Some(
1661+
dep_feat
1662+
.into_iter()
1663+
.chain(inherit_feat)
1664+
.collect::<Vec<String>>(),
1665+
),
1666+
(Some(dep_fet), None) => Some(dep_fet),
1667+
(None, Some(inherit_feat)) => Some(inherit_feat),
1668+
(None, None) => None,
1669+
};
16601670
d.optional = self.optional;
16611671
schema::TomlDependency::Detailed(d)
16621672
}
@@ -1712,20 +1722,6 @@ impl<P: ResolveToPath + Clone> schema::TomlDependency<P> {
17121722
}
17131723

17141724
impl schema::TomlDetailedDependency {
1715-
fn add_features(&mut self, features: Option<Vec<String>>) {
1716-
self.features = match (self.features.clone(), features.clone()) {
1717-
(Some(dep_feat), Some(inherit_feat)) => Some(
1718-
dep_feat
1719-
.into_iter()
1720-
.chain(inherit_feat)
1721-
.collect::<Vec<String>>(),
1722-
),
1723-
(Some(dep_fet), None) => Some(dep_fet),
1724-
(None, Some(inherit_feat)) => Some(inherit_feat),
1725-
(None, None) => None,
1726-
};
1727-
}
1728-
17291725
fn resolve_path(
17301726
&mut self,
17311727
name: &str,

0 commit comments

Comments
 (0)