Skip to content

Commit

Permalink
Removed root related flags
Browse files Browse the repository at this point in the history
  • Loading branch information
raytung committed Oct 3, 2017
1 parent f5961e6 commit 639bfb5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 17 deletions.
18 changes: 2 additions & 16 deletions src/cargo/core/resolver/encode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use super::Resolve;
#[derive(Serialize, Deserialize, Debug)]
pub struct EncodableResolve {
package: Option<Vec<EncodableDependency>>,
/// `root` is optional to allow forward compatibility.
/// `root` is optional to allow backward compatibility.
root: Option<EncodableDependency>,
metadata: Option<Metadata>,

Expand Down Expand Up @@ -311,7 +311,6 @@ impl<'de> de::Deserialize<'de> for EncodablePackageId {
pub struct WorkspaceResolve<'a, 'cfg: 'a> {
pub ws: &'a Workspace<'cfg>,
pub resolve: &'a Resolve,
pub use_root_key: bool,
}

impl<'a, 'cfg> ser::Serialize for WorkspaceResolve<'a, 'cfg> {
Expand All @@ -321,15 +320,7 @@ impl<'a, 'cfg> ser::Serialize for WorkspaceResolve<'a, 'cfg> {
let mut ids: Vec<&PackageId> = self.resolve.graph.iter().collect();
ids.sort();

let root = self.ws.members().max_by_key(|member| {
member.name()
}).map(Package::package_id);

let encodable = ids.iter().filter_map(|&id| {
if self.use_root_key && root.unwrap() == id {
return None
}

Some(encodable_resolve_node(id, self.resolve))
}).collect::<Vec<_>>();

Expand All @@ -347,11 +338,6 @@ impl<'a, 'cfg> ser::Serialize for WorkspaceResolve<'a, 'cfg> {

let metadata = if metadata.is_empty() { None } else { Some(metadata) };

let root = match root {
Some(root) if self.use_root_key => Some(encodable_resolve_node(root, self.resolve)),
_ => None,
};

let patch = Patch {
unused: self.resolve.unused_patches().iter().map(|id| {
EncodableDependency {
Expand All @@ -365,7 +351,7 @@ impl<'a, 'cfg> ser::Serialize for WorkspaceResolve<'a, 'cfg> {
};
EncodableResolve {
package: Some(encodable),
root: root,
root: None,
metadata: metadata,
patch: patch,
}.serialize(s)
Expand Down
1 change: 0 additions & 1 deletion src/cargo/ops/lockfile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ pub fn write_pkg_lockfile(ws: &Workspace, resolve: &Resolve) -> CargoResult<()>
let toml = toml::Value::try_from(WorkspaceResolve {
ws: ws,
resolve: resolve,
use_root_key: false,
}).unwrap();

let mut out = String::new();
Expand Down

0 comments on commit 639bfb5

Please sign in to comment.