diff --git a/src/cargo/util/toml/mod.rs b/src/cargo/util/toml/mod.rs index 4b62dbfb5dfb..1b4c5464ccd4 100644 --- a/src/cargo/util/toml/mod.rs +++ b/src/cargo/util/toml/mod.rs @@ -1221,33 +1221,6 @@ fn to_workspace_config( ws_root_config } -fn load_inheritable_fields( - gctx: &GlobalContext, - resolved_path: &Path, - workspace_config: &WorkspaceConfig, -) -> CargoResult { - match workspace_config { - WorkspaceConfig::Root(root) => Ok(root.inheritable().clone()), - WorkspaceConfig::Member { - root: Some(ref path_to_root), - } => { - let path = resolved_path - .parent() - .unwrap() - .join(path_to_root) - .join("Cargo.toml"); - let root_path = paths::normalize_path(&path); - inheritable_from_path(gctx, root_path) - } - WorkspaceConfig::Member { root: None } => { - match find_workspace_root(&resolved_path, gctx)? { - Some(path_to_root) => inheritable_from_path(gctx, path_to_root), - None => Err(anyhow!("failed to find a workspace root")), - } - } - } -} - fn to_virtual_manifest( contents: String, document: toml_edit::ImDocument, @@ -1554,6 +1527,33 @@ fn unused_dep_keys( } } +fn load_inheritable_fields( + gctx: &GlobalContext, + resolved_path: &Path, + workspace_config: &WorkspaceConfig, +) -> CargoResult { + match workspace_config { + WorkspaceConfig::Root(root) => Ok(root.inheritable().clone()), + WorkspaceConfig::Member { + root: Some(ref path_to_root), + } => { + let path = resolved_path + .parent() + .unwrap() + .join(path_to_root) + .join("Cargo.toml"); + let root_path = paths::normalize_path(&path); + inheritable_from_path(gctx, root_path) + } + WorkspaceConfig::Member { root: None } => { + match find_workspace_root(&resolved_path, gctx)? { + Some(path_to_root) => inheritable_from_path(gctx, path_to_root), + None => Err(anyhow!("failed to find a workspace root")), + } + } + } +} + fn inheritable_from_path( gctx: &GlobalContext, workspace_path: PathBuf,