Return early and decline analysis when linting within unsafe functions for must_root analysis.

Removes a handful of whitelist annotations obsoleted by this change. fixes #3658
This commit is contained in:
Chris Manchester 2014-11-26 20:02:35 -05:00
parent c91e949ed0
commit d25bc49772
2 changed files with 51 additions and 12 deletions

View file

@ -201,7 +201,6 @@ pub trait RawLayoutElementHelpers {
}
#[inline]
#[allow(unrooted_must_root)]
unsafe fn get_attr_for_layout<'a>(elem: &'a Element, namespace: &Namespace, name: &Atom) -> Option<&'a JS<Attr>> {
// cast to point to T in RefCell<T> directly
let attrs: *const Vec<JS<Attr>> = mem::transmute(&elem.attrs);
@ -214,7 +213,6 @@ unsafe fn get_attr_for_layout<'a>(elem: &'a Element, namespace: &Namespace, name
impl RawLayoutElementHelpers for Element {
#[inline]
#[allow(unrooted_must_root)]
unsafe fn get_attr_val_for_layout<'a>(&'a self, namespace: &Namespace, name: &Atom)
-> Option<&'a str> {
get_attr_for_layout(self, namespace, name).map(|attr| {
@ -224,7 +222,6 @@ impl RawLayoutElementHelpers for Element {
}
#[inline]
#[allow(unrooted_must_root)]
unsafe fn get_attr_vals_for_layout<'a>(&'a self, name: &Atom) -> Vec<&'a str> {
let attrs = self.attrs.borrow_for_layout();
(*attrs).iter().filter_map(|attr: &JS<Attr>| {
@ -238,7 +235,6 @@ impl RawLayoutElementHelpers for Element {
}
#[inline]
#[allow(unrooted_must_root)]
unsafe fn get_attr_atom_for_layout(&self, namespace: &Namespace, name: &Atom)
-> Option<Atom> {
let attrs = self.attrs.borrow_for_layout();
@ -253,7 +249,6 @@ impl RawLayoutElementHelpers for Element {
}
#[inline]
#[allow(unrooted_must_root)]
unsafe fn has_class_for_layout(&self, name: &Atom) -> bool {
let attrs = self.attrs.borrow_for_layout();
(*attrs).iter().find(|attr: & &JS<Attr>| {
@ -268,7 +263,6 @@ impl RawLayoutElementHelpers for Element {
}
#[inline]
#[allow(unrooted_must_root)]
unsafe fn get_classes_for_layout(&self) -> Option<&'static [Atom]> {
let attrs = self.attrs.borrow_for_layout();
(*attrs).iter().find(|attr: & &JS<Attr>| {
@ -281,7 +275,6 @@ impl RawLayoutElementHelpers for Element {
}
#[inline]
#[allow(unrooted_must_root)]
unsafe fn get_length_attribute_for_layout(&self, length_attribute: LengthAttribute)
-> LengthOrPercentageOrAuto {
match length_attribute {
@ -296,7 +289,6 @@ impl RawLayoutElementHelpers for Element {
}
#[inline]
#[allow(unrooted_must_root)]
unsafe fn get_integer_attribute_for_layout(&self, integer_attribute: IntegerAttribute)
-> Option<i32> {
match integer_attribute {
@ -331,7 +323,6 @@ pub trait LayoutElementHelpers {
}
impl LayoutElementHelpers for JS<Element> {
#[allow(unrooted_must_root)]
#[inline]
unsafe fn html_element_in_html_document_for_layout(&self) -> bool {
if (*self.unsafe_get()).namespace != ns!(HTML) {