Minor style cleanups in Cache code

- Make ApplicableDeclarationsCache::cache priv
- Add a missing semicolon for clarity
- Remove a useless `drop` call.
This commit is contained in:
Matt Brubeck 2014-06-04 13:18:44 -07:00
parent 33c4a7a5dc
commit b7ba2157a1
2 changed files with 3 additions and 3 deletions

View file

@ -131,7 +131,7 @@ impl<'a> Hash for ApplicableDeclarationsCacheQuery<'a> {
static APPLICABLE_DECLARATIONS_CACHE_SIZE: uint = 32; static APPLICABLE_DECLARATIONS_CACHE_SIZE: uint = 32;
pub struct ApplicableDeclarationsCache { pub struct ApplicableDeclarationsCache {
pub cache: SimpleHashCache<ApplicableDeclarationsCacheEntry,Arc<ComputedValues>>, cache: SimpleHashCache<ApplicableDeclarationsCacheEntry,Arc<ComputedValues>>,
} }
impl ApplicableDeclarationsCache { impl ApplicableDeclarationsCache {
@ -149,7 +149,7 @@ impl ApplicableDeclarationsCache {
} }
fn insert(&mut self, declarations: &[MatchedProperty], style: Arc<ComputedValues>) { fn insert(&mut self, declarations: &[MatchedProperty], style: Arc<ComputedValues>) {
drop(self.cache.insert(ApplicableDeclarationsCacheEntry::new(declarations), style)) self.cache.insert(ApplicableDeclarationsCacheEntry::new(declarations), style)
} }
} }

View file

@ -216,7 +216,7 @@ impl<K:Clone+Eq+Hash,V:Clone> SimpleHashCache<K,V> {
impl<K:Clone+Eq+Hash,V:Clone> Cache<K,V> for SimpleHashCache<K,V> { impl<K:Clone+Eq+Hash,V:Clone> Cache<K,V> for SimpleHashCache<K,V> {
fn insert(&mut self, key: K, value: V) { fn insert(&mut self, key: K, value: V) {
let bucket_index = self.bucket_for_key(&key); let bucket_index = self.bucket_for_key(&key);
*self.entries.get_mut(bucket_index) = Some((key, value)) *self.entries.get_mut(bucket_index) = Some((key, value));
} }
fn find(&mut self, key: &K) -> Option<V> { fn find(&mut self, key: &K) -> Option<V> {