Skip to content

Commit

Permalink
remove dead code
Browse files Browse the repository at this point in the history
  • Loading branch information
Eh2406 committed Apr 18, 2019
1 parent 097dbdf commit 8cd9b0c
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 49 deletions.
2 changes: 1 addition & 1 deletion src/cargo/core/resolver/context.rs
Expand Up @@ -13,7 +13,7 @@ use crate::util::CargoResult;
use crate::util::Graph;

use super::errors::ActivateResult;
use super::types::{ConflictMap, ConflictReason, DepInfo, GraphNode, Method, RegistryQueryer};
use super::types::{ConflictMap, ConflictReason, DepInfo, Method, RegistryQueryer};

pub use super::encode::{EncodableDependency, EncodablePackageId, EncodableResolve};
pub use super::encode::{Metadata, WorkspaceResolve};
Expand Down
2 changes: 1 addition & 1 deletion src/cargo/core/resolver/mod.rs
Expand Up @@ -62,7 +62,7 @@ use crate::util::errors::CargoResult;
use crate::util::profile;

use self::context::{Activations, Context};
use self::types::{Candidate, ConflictMap, ConflictReason, DepsFrame, GraphNode};
use self::types::{Candidate, ConflictMap, ConflictReason, DepsFrame};
use self::types::{RcVecIter, RegistryQueryer, RemainingDeps, ResolverProgress};

pub use self::encode::{EncodableDependency, EncodablePackageId, EncodableResolve};
Expand Down
47 changes: 0 additions & 47 deletions src/cargo/core/resolver/types.rs
Expand Up @@ -491,50 +491,3 @@ where
}

impl<T: Clone> ExactSizeIterator for RcVecIter<T> {}

pub struct RcList<T> {
pub head: Option<Rc<(T, RcList<T>)>>,
}

impl<T> RcList<T> {
pub fn new() -> RcList<T> {
RcList { head: None }
}

pub fn push(&mut self, data: T) {
let node = Rc::new((
data,
RcList {
head: self.head.take(),
},
));
self.head = Some(node);
}
}

// Not derived to avoid `T: Clone`
impl<T> Clone for RcList<T> {
fn clone(&self) -> RcList<T> {
RcList {
head: self.head.clone(),
}
}
}

// Avoid stack overflows on drop by turning recursion into a loop
impl<T> Drop for RcList<T> {
fn drop(&mut self) {
let mut cur = self.head.take();
while let Some(head) = cur {
match Rc::try_unwrap(head) {
Ok((_data, mut next)) => cur = next.head.take(),
Err(_) => break,
}
}
}
}

pub enum GraphNode {
Add(PackageId),
Link(PackageId, PackageId, Dependency),
}

0 comments on commit 8cd9b0c

Please sign in to comment.