Skip to content

Commit cb0df8e

Browse files
committed
Use HashMap insted of BTreeMap
1 parent a81e08b commit cb0df8e

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

src/cargo/core/dependency.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@ use util::errors::{CargoResult, CargoResultExt, CargoError};
1212

1313
/// Information about a dependency requested by a Cargo manifest.
1414
/// Cheap to copy.
15-
#[derive(PartialEq, Eq, Ord, PartialOrd, Clone, Debug)]
15+
#[derive(PartialEq, Eq, Hash, Ord, PartialOrd, Clone, Debug)]
1616
pub struct Dependency {
1717
inner: Rc<Inner>,
1818
}
1919

2020
/// The data underlying a Dependency.
21-
#[derive(PartialEq, Eq, Ord, PartialOrd, Clone, Debug)]
21+
#[derive(PartialEq, Eq, Hash, Ord, PartialOrd, Clone, Debug)]
2222
struct Inner {
2323
name: String,
2424
source_id: SourceId,
@@ -38,7 +38,7 @@ struct Inner {
3838
platform: Option<Platform>,
3939
}
4040

41-
#[derive(Eq, PartialEq, Ord, PartialOrd, Clone, Debug)]
41+
#[derive(Eq, PartialEq, Hash, Ord, PartialOrd, Clone, Debug)]
4242
pub enum Platform {
4343
Name(String),
4444
Cfg(CfgExpr),
@@ -76,7 +76,7 @@ impl ser::Serialize for Dependency {
7676
}
7777
}
7878

79-
#[derive(PartialEq, Eq, Ord, PartialOrd, Clone, Debug, Copy)]
79+
#[derive(PartialEq, Eq, Hash, Ord, PartialOrd, Clone, Debug, Copy)]
8080
pub enum Kind {
8181
Normal,
8282
Development,

src/cargo/core/resolver/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -574,15 +574,15 @@ struct RegistryQueryer<'a> {
574574
registry: &'a mut (Registry + 'a),
575575
replacements: &'a [(PackageIdSpec, Dependency)],
576576
// TODO: with nll the Rc can be removed
577-
cache: BTreeMap<Dependency, Rc<Vec<Candidate>>>,
577+
cache: HashMap<Dependency, Rc<Vec<Candidate>>>,
578578
}
579579

580580
impl<'a> RegistryQueryer<'a> {
581581
fn new(registry: &'a mut Registry, replacements: &'a [(PackageIdSpec, Dependency)],) -> Self {
582582
RegistryQueryer {
583583
registry,
584584
replacements,
585-
cache: BTreeMap::new(),
585+
cache: HashMap::new(),
586586
}
587587
}
588588

src/cargo/util/cfg.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ use std::fmt;
44

55
use util::{CargoError, CargoResult};
66

7-
#[derive(Eq, PartialEq, Ord, PartialOrd, Clone, Debug)]
7+
#[derive(Eq, PartialEq, Hash, Ord, PartialOrd, Clone, Debug)]
88
pub enum Cfg {
99
Name(String),
1010
KeyPair(String, String),
1111
}
1212

13-
#[derive(Eq, PartialEq, Ord, PartialOrd, Clone, Debug)]
13+
#[derive(Eq, PartialEq, Hash, Ord, PartialOrd, Clone, Debug)]
1414
pub enum CfgExpr {
1515
Not(Box<CfgExpr>),
1616
All(Vec<CfgExpr>),

0 commit comments

Comments
 (0)