diff --git a/src/cargo/core/resolver/context.rs b/src/cargo/core/resolver/context.rs index f784c3da927..58a86342db5 100644 --- a/src/cargo/core/resolver/context.rs +++ b/src/cargo/core/resolver/context.rs @@ -15,8 +15,8 @@ use crate::util::Graph; use super::dep_cache::RegistryQueryer; use super::types::{ConflictMap, FeaturesSet, Method}; +pub use super::encode::Metadata; pub use super::encode::{EncodableDependency, EncodablePackageId, EncodableResolve}; -pub use super::encode::{Metadata, WorkspaceResolve}; pub use super::resolve::Resolve; // A `Context` is basically a bunch of local resolution information which is diff --git a/src/cargo/core/resolver/encode.rs b/src/cargo/core/resolver/encode.rs index 1d3a6b30a97..12324c5abb7 100644 --- a/src/cargo/core/resolver/encode.rs +++ b/src/cargo/core/resolver/encode.rs @@ -325,28 +325,23 @@ impl<'de> de::Deserialize<'de> for EncodablePackageId { } } -pub struct WorkspaceResolve<'a, 'cfg> { - pub ws: &'a Workspace<'cfg>, - pub resolve: &'a Resolve, -} - -impl<'a, 'cfg> ser::Serialize for WorkspaceResolve<'a, 'cfg> { +impl<'a> ser::Serialize for Resolve { fn serialize(&self, s: S) -> Result where S: ser::Serializer, { - let mut ids: Vec<_> = self.resolve.iter().collect(); + let mut ids: Vec<_> = self.iter().collect(); ids.sort(); let encodable = ids .iter() - .map(|&id| encodable_resolve_node(id, self.resolve)) + .map(|&id| encodable_resolve_node(id, self)) .collect::>(); - let mut metadata = self.resolve.metadata().clone(); + let mut metadata = self.metadata().clone(); for &id in ids.iter().filter(|id| !id.source_id().is_path()) { - let checksum = match self.resolve.checksums()[&id] { + let checksum = match self.checksums()[&id] { Some(ref s) => &s[..], None => "", }; @@ -362,7 +357,6 @@ impl<'a, 'cfg> ser::Serialize for WorkspaceResolve<'a, 'cfg> { let patch = Patch { unused: self - .resolve .unused_patches() .iter() .map(|id| EncodableDependency { diff --git a/src/cargo/core/resolver/mod.rs b/src/cargo/core/resolver/mod.rs index 1e2265943ca..7dc3b862836 100644 --- a/src/cargo/core/resolver/mod.rs +++ b/src/cargo/core/resolver/mod.rs @@ -65,8 +65,8 @@ use self::dep_cache::RegistryQueryer; use self::types::{ConflictMap, ConflictReason, DepsFrame}; use self::types::{FeaturesSet, RcVecIter, RemainingDeps, ResolverProgress}; +pub use self::encode::Metadata; pub use self::encode::{EncodableDependency, EncodablePackageId, EncodableResolve}; -pub use self::encode::{Metadata, WorkspaceResolve}; pub use self::errors::{ActivateError, ActivateResult, ResolveError}; pub use self::resolve::Resolve; pub use self::types::Method; diff --git a/src/cargo/ops/lockfile.rs b/src/cargo/ops/lockfile.rs index 2197f45ee8a..fd4ce44be04 100644 --- a/src/cargo/ops/lockfile.rs +++ b/src/cargo/ops/lockfile.rs @@ -2,7 +2,6 @@ use std::io::prelude::*; use toml; -use crate::core::resolver::WorkspaceResolve; use crate::core::{resolver, Resolve, Workspace}; use crate::util::errors::{CargoResult, CargoResultExt}; use crate::util::toml as cargo_toml; @@ -89,7 +88,7 @@ fn resolve_to_string_orig( Ok(s) }); - let toml = toml::Value::try_from(WorkspaceResolve { ws, resolve }).unwrap(); + let toml = toml::Value::try_from(resolve).unwrap(); let mut out = String::new();