Skip to content

Commit 89f8f5c

Browse files
committed
refactor(toml): Make Dep's to_dependency_split a free function
1 parent 8ff20c7 commit 89f8f5c

File tree

2 files changed

+29
-30
lines changed

2 files changed

+29
-30
lines changed

src/cargo/core/workspace.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,8 @@ impl<'cfg> Workspace<'cfg> {
437437
url,
438438
deps.iter()
439439
.map(|(name, dep)| {
440-
dep.to_dependency_split(
440+
crate::util::toml::to_dependency(
441+
dep,
441442
name,
442443
source,
443444
&mut nested_paths,

src/cargo/util/toml/mod.rs

Lines changed: 27 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1694,35 +1694,33 @@ fn inner_dependency_inherit_with<'a>(
16941694
})
16951695
}
16961696

1697-
impl<P: ResolveToPath + Clone> schema::TomlDependency<P> {
1698-
pub(crate) fn to_dependency_split(
1699-
&self,
1700-
name: &str,
1701-
source_id: SourceId,
1702-
nested_paths: &mut Vec<PathBuf>,
1703-
config: &Config,
1704-
warnings: &mut Vec<String>,
1705-
platform: Option<Platform>,
1706-
root: &Path,
1707-
features: &Features,
1708-
kind: Option<DepKind>,
1709-
) -> CargoResult<Dependency> {
1710-
dep_to_dependency(
1711-
self,
1712-
name,
1713-
&mut Context {
1714-
deps: &mut Vec::new(),
1715-
source_id,
1716-
nested_paths,
1717-
config,
1718-
warnings,
1719-
platform,
1720-
root,
1721-
features,
1722-
},
1723-
kind,
1724-
)
1725-
}
1697+
pub(crate) fn to_dependency<P: ResolveToPath + Clone>(
1698+
dep: &schema::TomlDependency<P>,
1699+
name: &str,
1700+
source_id: SourceId,
1701+
nested_paths: &mut Vec<PathBuf>,
1702+
config: &Config,
1703+
warnings: &mut Vec<String>,
1704+
platform: Option<Platform>,
1705+
root: &Path,
1706+
features: &Features,
1707+
kind: Option<DepKind>,
1708+
) -> CargoResult<Dependency> {
1709+
dep_to_dependency(
1710+
dep,
1711+
name,
1712+
&mut Context {
1713+
deps: &mut Vec::new(),
1714+
source_id,
1715+
nested_paths,
1716+
config,
1717+
warnings,
1718+
platform,
1719+
root,
1720+
features,
1721+
},
1722+
kind,
1723+
)
17261724
}
17271725

17281726
fn dep_to_dependency<P: ResolveToPath + Clone>(

0 commit comments

Comments
 (0)