aboutsummaryrefslogtreecommitdiffstats
path: root/components/layout/css/matching.rs
diff options
context:
space:
mode:
authorbors-servo <metajack+bors@gmail.com>2015-09-09 00:05:17 -0600
committerbors-servo <metajack+bors@gmail.com>2015-09-09 00:05:17 -0600
commitbe9a9ffda10fa2c50b13f79dabd49255f29f12f6 (patch)
tree9622df47c5446e93def3e0012de97e31bc188778 /components/layout/css/matching.rs
parent83972196600f04e817ddb53fda18142778905307 (diff)
parent94dec69247504a976cfa61495da759286160abec (diff)
downloadservo-be9a9ffda10fa2c50b13f79dabd49255f29f12f6.tar.gz
servo-be9a9ffda10fa2c50b13f79dabd49255f29f12f6.zip
Auto merge of #7523 - eefriedman:unnecessary-unsafe, r=SimonSapin
Fix up some unnecessary uses of `unsafe`. <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/7523) <!-- Reviewable:end -->
Diffstat (limited to 'components/layout/css/matching.rs')
-rw-r--r--components/layout/css/matching.rs9
1 files changed, 4 insertions, 5 deletions
diff --git a/components/layout/css/matching.rs b/components/layout/css/matching.rs
index 22d66bac70c..ded2d27842b 100644
--- a/components/layout/css/matching.rs
+++ b/components/layout/css/matching.rs
@@ -23,13 +23,12 @@ use selectors::parser::PseudoElement;
use selectors::{Element};
use std::borrow::ToOwned;
use std::hash::{Hash, Hasher};
-use std::mem;
use std::slice::Iter;
use std::sync::Arc;
use std::sync::mpsc::Sender;
use string_cache::{Atom, Namespace};
use style::node::TElementAttributes;
-use style::properties::{ComputedValues, cascade};
+use style::properties::{ComputedValues, cascade, PropertyDeclaration};
use style::selector_matching::{Stylist, DeclarationBlock};
use util::arc_ptr_eq;
use util::cache::{LRUCache, SimpleHashCache};
@@ -128,9 +127,9 @@ impl<'a> PartialEq<ApplicableDeclarationsCacheEntry> for ApplicableDeclarationsC
impl<'a> Hash for ApplicableDeclarationsCacheQuery<'a> {
fn hash<H: Hasher>(&self, state: &mut H) {
for declaration in self.declarations {
- let ptr: usize = unsafe {
- mem::transmute_copy(declaration)
- };
+ // Each declaration contians an Arc, which is a stable
+ // pointer; we use that for hashing and equality.
+ let ptr = &*declaration.declarations as *const Vec<PropertyDeclaration>;
ptr.hash(state);
}
}