Skip to content

Commit 89bfc4d

Browse files
committed
refactor(toml): Inline TomlDetailedDependency::resolve_path
1 parent 97c9a17 commit 89bfc4d

File tree

1 file changed

+8
-20
lines changed

1 file changed

+8
-20
lines changed

src/cargo/util/toml/mod.rs

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1514,7 +1514,14 @@ impl InheritableFields {
15141514
};
15151515
let mut dep = dep.clone();
15161516
if let schema::TomlDependency::Detailed(detailed) = &mut dep {
1517-
detailed.resolve_path(name, self.ws_root(), package_root)?;
1517+
if let Some(rel_path) = &detailed.path {
1518+
detailed.path = Some(resolve_relative_path(
1519+
name,
1520+
self.ws_root(),
1521+
package_root,
1522+
rel_path,
1523+
)?);
1524+
}
15181525
}
15191526
Ok(dep)
15201527
}
@@ -1721,25 +1728,6 @@ impl<P: ResolveToPath + Clone> schema::TomlDependency<P> {
17211728
}
17221729
}
17231730

1724-
impl schema::TomlDetailedDependency {
1725-
fn resolve_path(
1726-
&mut self,
1727-
name: &str,
1728-
root_path: &Path,
1729-
package_root: &Path,
1730-
) -> CargoResult<()> {
1731-
if let Some(rel_path) = &self.path {
1732-
self.path = Some(resolve_relative_path(
1733-
name,
1734-
root_path,
1735-
package_root,
1736-
rel_path,
1737-
)?)
1738-
}
1739-
Ok(())
1740-
}
1741-
}
1742-
17431731
impl<P: ResolveToPath + Clone> schema::TomlDetailedDependency<P> {
17441732
fn to_dependency(
17451733
&self,

0 commit comments

Comments
 (0)