aboutsummaryrefslogtreecommitdiffstats
path: root/components/util/cache.rs
diff options
context:
space:
mode:
authorMs2ger <ms2ger@gmail.com>2015-01-02 12:45:28 +0100
committerJosh Matthews <josh@joshmatthews.net>2015-01-08 09:58:46 -0500
commit16c7060bc8ff91527ae97f8a3feee5706747b9c5 (patch)
tree0cc29f2cc50c729d3a8f9521a22991fad67b9afd /components/util/cache.rs
parentcf616b90a236f88058dbad74b568b4d4379d2829 (diff)
downloadservo-16c7060bc8ff91527ae97f8a3feee5706747b9c5.tar.gz
servo-16c7060bc8ff91527ae97f8a3feee5706747b9c5.zip
Update rustc to revision 2cfb5acb5a2751c759627377e602bac4f88f2d19.
Diffstat (limited to 'components/util/cache.rs')
-rw-r--r--components/util/cache.rs8
1 files changed, 3 insertions, 5 deletions
diff --git a/components/util/cache.rs b/components/util/cache.rs
index 2797bc4e6d6..03bd649f777 100644
--- a/components/util/cache.rs
+++ b/components/util/cache.rs
@@ -69,14 +69,12 @@ impl<K,V> HashCache<K,V> where K: Clone + PartialEq + Eq + Hash, V: Clone {
#[test]
fn test_hashcache() {
let mut cache: HashCache<uint, Cell<&str>> = HashCache::new();
- let one = Cell::new("one");
- let two = Cell::new("two");
- cache.insert(1, one);
+ cache.insert(1, Cell::new("one"));
assert!(cache.find(&1).is_some());
assert!(cache.find(&2).is_none());
- cache.find_or_create(&2, |_v| { two });
+ cache.find_or_create(&2, |_v| { Cell::new("two") });
assert!(cache.find(&1).is_some());
assert!(cache.find(&2).is_some());
}
@@ -233,7 +231,7 @@ fn test_lru_cache() {
assert!(cache.find(&4).is_some()); // (2, 4) (no change)
// Test find_or_create.
- cache.find_or_create(&1, |_| { one }); // (4, 1)
+ cache.find_or_create(&1, |_| { Cell::new("one") }); // (4, 1)
assert!(cache.find(&1).is_some()); // (4, 1) (no change)
assert!(cache.find(&2).is_none()); // (4, 1) (no change)