Deny unsafe blocks in script.

As a first start, this allows them indiscriminately where used.
This commit is contained in:
Ms2ger 2015-01-08 17:33:34 +01:00
parent d9751c0fbb
commit edc1d89251
14 changed files with 27 additions and 0 deletions

View file

@ -1283,12 +1283,14 @@ impl<'a> VirtualMethods for JSRef<'a, Element> {
}
impl<'a> style::TElement<'a> for JSRef<'a, Element> {
#[allow(unsafe_blocks)]
fn get_attr(self, namespace: &Namespace, attr: &Atom) -> Option<&'a str> {
self.get_attribute(namespace.clone(), attr).root().map(|attr| {
// This transmute is used to cheat the lifetime restriction.
unsafe { mem::transmute(attr.r().value().as_slice()) }
})
}
#[allow(unsafe_blocks)]
fn get_attrs(self, attr: &Atom) -> Vec<&'a str> {
self.get_attributes(attr).into_iter().map(|attr| attr.root()).map(|attr| {
// This transmute is used to cheat the lifetime restriction.