Use `HashMap` insted of `BTreeMap`
authorEh2406 <YeomanYaacov@gmail.com>
Sat, 3 Mar 2018 17:49:15 +0000 (12:49 -0500)
committerEh2406 <YeomanYaacov@gmail.com>
Sat, 3 Mar 2018 17:50:37 +0000 (12:50 -0500)
src/cargo/core/dependency.rs
src/cargo/core/resolver/mod.rs
src/cargo/util/cfg.rs

index 122f060eaac07114b2eebd1e5e5f3e0c30ee9986..00fddd499089355751768561a64de9e7dd9faab6 100644 (file)
@@ -12,13 +12,13 @@ use util::errors::{CargoResult, CargoResultExt, CargoError};
 
 /// Information about a dependency requested by a Cargo manifest.
 /// Cheap to copy.
-#[derive(PartialEq, Eq, Ord, PartialOrd, Clone, Debug)]
+#[derive(PartialEq, Eq, Hash, Ord, PartialOrd, Clone, Debug)]
 pub struct Dependency {
     inner: Rc<Inner>,
 }
 
 /// The data underlying a Dependency.
-#[derive(PartialEq, Eq, Ord, PartialOrd, Clone, Debug)]
+#[derive(PartialEq, Eq, Hash, Ord, PartialOrd, Clone, Debug)]
 struct Inner {
     name: String,
     source_id: SourceId,
@@ -38,7 +38,7 @@ struct Inner {
     platform: Option<Platform>,
 }
 
-#[derive(Eq, PartialEq, Ord, PartialOrd, Clone, Debug)]
+#[derive(Eq, PartialEq, Hash, Ord, PartialOrd, Clone, Debug)]
 pub enum Platform {
     Name(String),
     Cfg(CfgExpr),
@@ -76,7 +76,7 @@ impl ser::Serialize for Dependency {
     }
 }
 
-#[derive(PartialEq, Eq, Ord, PartialOrd, Clone, Debug, Copy)]
+#[derive(PartialEq, Eq, Hash, Ord, PartialOrd, Clone, Debug, Copy)]
 pub enum Kind {
     Normal,
     Development,
index c461b9d6a302ff60a4999b9b901e86b3032a1f9f..264c32c82e66db9387e28d08e1870e66118d1bb4 100644 (file)
@@ -574,7 +574,7 @@ struct RegistryQueryer<'a> {
     registry: &'a mut (Registry + 'a),
     replacements: &'a [(PackageIdSpec, Dependency)],
     // TODO: with nll the Rc can be removed
-    cache: BTreeMap<Dependency, Rc<Vec<Candidate>>>,
+    cache: HashMap<Dependency, Rc<Vec<Candidate>>>,
 }
 
 impl<'a> RegistryQueryer<'a> {
@@ -582,7 +582,7 @@ impl<'a> RegistryQueryer<'a> {
         RegistryQueryer {
             registry,
             replacements,
-            cache: BTreeMap::new(),
+            cache: HashMap::new(),
         }
     }
 
index 847d00df1fe36d5ba7795202e7dd20ba61b492bb..b1d73a8351572165958e89f777ddbb24c6db3deb 100644 (file)
@@ -4,13 +4,13 @@ use std::fmt;
 
 use util::{CargoError, CargoResult};
 
-#[derive(Eq, PartialEq, Ord, PartialOrd, Clone, Debug)]
+#[derive(Eq, PartialEq, Hash, Ord, PartialOrd, Clone, Debug)]
 pub enum Cfg {
     Name(String),
     KeyPair(String, String),
 }
 
-#[derive(Eq, PartialEq, Ord, PartialOrd, Clone, Debug)]
+#[derive(Eq, PartialEq, Hash, Ord, PartialOrd, Clone, Debug)]
 pub enum CfgExpr {
     Not(Box<CfgExpr>),
     All(Vec<CfgExpr>),