Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove now-unused WorkspaceResolve #7127

Merged
merged 1 commit into from
Jul 15, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/cargo/core/resolver/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
16 changes: 5 additions & 11 deletions src/cargo/core/resolver/encode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<S>(&self, s: S) -> Result<S::Ok, S::Error>
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::<Vec<_>>();

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 => "<none>",
};
Expand All @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion src/cargo/core/resolver/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 1 addition & 2 deletions src/cargo/ops/lockfile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();

Expand Down