diff --git a/src/cargo/core/package.rs b/src/cargo/core/package.rs index 3ec85b9e271..2c47d91391b 100644 --- a/src/cargo/core/package.rs +++ b/src/cargo/core/package.rs @@ -63,7 +63,7 @@ struct SerializedPackage<'a> { dependencies: &'a [Dependency], targets: Vec<&'a Target>, features: &'a FeatureMap, - manifest_path: &'a str, + manifest_path: &'a Path, metadata: Option<&'a toml::Value>, authors: &'a [String], categories: &'a [String], @@ -113,7 +113,7 @@ impl ser::Serialize for Package { dependencies: summary.dependencies(), targets, features: summary.features(), - manifest_path: &self.manifest_path.display().to_string(), + manifest_path: &self.manifest_path, metadata: self.manifest.custom_metadata(), authors, categories, diff --git a/src/cargo/ops/cargo_output_metadata.rs b/src/cargo/ops/cargo_output_metadata.rs index d66301b862e..0b05f667867 100644 --- a/src/cargo/ops/cargo_output_metadata.rs +++ b/src/cargo/ops/cargo_output_metadata.rs @@ -1,4 +1,5 @@ use std::collections::HashMap; +use std::path::PathBuf; use serde::ser; use serde::Serialize; @@ -41,9 +42,9 @@ fn metadata_no_deps(ws: &Workspace<'_>, _opt: &OutputMetadataOptions) -> CargoRe packages: ws.members().cloned().collect(), workspace_members: ws.members().map(|pkg| pkg.package_id()).collect(), resolve: None, - target_directory: ws.target_dir().display().to_string(), + target_directory: ws.target_dir().clone().into_path_unlocked(), version: VERSION, - workspace_root: ws.root().display().to_string(), + workspace_root: ws.root().to_path_buf(), }) } @@ -69,9 +70,9 @@ fn metadata_full(ws: &Workspace<'_>, opt: &OutputMetadataOptions) -> CargoResult resolve: (packages, resolve), root: ws.current_opt().map(|pkg| pkg.package_id()), }), - target_directory: ws.target_dir().display().to_string(), + target_directory: ws.target_dir().clone().into_path_unlocked(), version: VERSION, - workspace_root: ws.root().display().to_string(), + workspace_root: ws.root().to_path_buf(), }) } @@ -80,9 +81,9 @@ pub struct ExportInfo { packages: Vec, workspace_members: Vec, resolve: Option, - target_directory: String, + target_directory: PathBuf, version: u32, - workspace_root: String, + workspace_root: PathBuf, } /// Newtype wrapper to provide a custom `Serialize` implementation.