Skip to content

Commit e313b61

Browse files
committed
refactor: move getters method together
1 parent d99fed2 commit e313b61

File tree

1 file changed

+20
-20
lines changed

1 file changed

+20
-20
lines changed

src/cargo/util/toml/mod.rs

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1632,18 +1632,6 @@ impl InheritableFields {
16321632
("package.version", version -> semver::Version),
16331633
}
16341634

1635-
pub fn update_deps(&mut self, deps: Option<BTreeMap<String, TomlDependency>>) {
1636-
self.dependencies = deps;
1637-
}
1638-
1639-
pub fn update_lints(&mut self, lints: Option<TomlLints>) {
1640-
self.lints = lints;
1641-
}
1642-
1643-
pub fn update_ws_path(&mut self, ws_root: PathBuf) {
1644-
self.ws_root = ws_root;
1645-
}
1646-
16471635
/// Gets a workspace dependency with the `name`.
16481636
pub fn get_dependency(&self, name: &str, package_root: &Path) -> CargoResult<TomlDependency> {
16491637
let Some(deps) = &self.dependencies else {
@@ -1659,6 +1647,14 @@ impl InheritableFields {
16591647
Ok(dep)
16601648
}
16611649

1650+
/// Gets the field `workspace.package.license-file`.
1651+
pub fn license_file(&self, package_root: &Path) -> CargoResult<String> {
1652+
let Some(license_file) = &self.license_file else {
1653+
bail!("`workspace.package.license-file` was not defined");
1654+
};
1655+
resolve_relative_path("license-file", &self.ws_root, package_root, license_file)
1656+
}
1657+
16621658
/// Gets the field `workspace.package.readme`.
16631659
pub fn readme(&self, package_root: &Path) -> CargoResult<StringOrBool> {
16641660
let Some(readme) = readme_for_package(self.ws_root.as_path(), self.readme.as_ref()) else {
@@ -1668,17 +1664,21 @@ impl InheritableFields {
16681664
.map(StringOrBool::String)
16691665
}
16701666

1671-
/// Gets the field `workspace.package.license-file`.
1672-
pub fn license_file(&self, package_root: &Path) -> CargoResult<String> {
1673-
let Some(license_file) = &self.license_file else {
1674-
bail!("`workspace.package.license-file` was not defined");
1675-
};
1676-
resolve_relative_path("license-file", &self.ws_root, package_root, license_file)
1677-
}
1678-
16791667
pub fn ws_root(&self) -> &PathBuf {
16801668
&self.ws_root
16811669
}
1670+
1671+
pub fn update_deps(&mut self, deps: Option<BTreeMap<String, TomlDependency>>) {
1672+
self.dependencies = deps;
1673+
}
1674+
1675+
pub fn update_lints(&mut self, lints: Option<TomlLints>) {
1676+
self.lints = lints;
1677+
}
1678+
1679+
pub fn update_ws_path(&mut self, ws_root: PathBuf) {
1680+
self.ws_root = ws_root;
1681+
}
16821682
}
16831683

16841684
impl TomlPackage {

0 commit comments

Comments
 (0)