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 -->
This commit is contained in:
bors-servo 2015-09-09 00:05:17 -06:00
commit be9a9ffda1
8 changed files with 208 additions and 226 deletions

View file

@ -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);
}
}