Skip to content

Commit

Permalink
Auto merge of #7127 - alexcrichton:less-params, r=Eh2406
Browse files Browse the repository at this point in the history
Remove now-unused `WorkspaceResolve`

The reason this type existed was to pass in a `Workspace`, but that's no
longer necessary!
  • Loading branch information
bors committed Jul 15, 2019
2 parents 7b84c53 + 1a37d00 commit 1760f1f
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 15 deletions.
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

0 comments on commit 1760f1f

Please sign in to comment.