Auto merge of #9089 - Ms2ger:style-unsafe, r=nox

Deny unsafe code in style.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9089)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2015-12-30 20:12:20 +05:30
commit d6d70feabd
4 changed files with 9 additions and 0 deletions

View file

@ -14,6 +14,8 @@
#![plugin(serde_macros)] #![plugin(serde_macros)]
#![plugin(plugins)] #![plugin(plugins)]
#![deny(unsafe_code)]
extern crate app_units; extern crate app_units;
#[macro_use] #[macro_use]
extern crate bitflags; extern crate bitflags;
@ -61,6 +63,7 @@ pub mod viewport;
// Generated from the properties.mako.rs template by build.rs // Generated from the properties.mako.rs template by build.rs
#[macro_use] #[macro_use]
#[allow(unsafe_code)]
pub mod properties { pub mod properties {
include!(concat!(env!("OUT_DIR"), "/properties.rs")); include!(concat!(env!("OUT_DIR"), "/properties.rs"));
} }

View file

@ -197,6 +197,7 @@ impl StyleSharingCandidate {
/// Attempts to create a style sharing candidate from this node. Returns /// Attempts to create a style sharing candidate from this node. Returns
/// the style sharing candidate or `None` if this node is ineligible for /// the style sharing candidate or `None` if this node is ineligible for
/// style sharing. /// style sharing.
#[allow(unsafe_code)]
fn new<'le, E: TElement<'le>>(element: &E) -> Option<StyleSharingCandidate> { fn new<'le, E: TElement<'le>>(element: &E) -> Option<StyleSharingCandidate> {
let parent_element = match element.parent_element() { let parent_element = match element.parent_element() {
None => return None, None => return None,

View file

@ -2,6 +2,9 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
// For lazy_static
#![allow(unsafe_code)]
use cssparser::{Parser, SourcePosition}; use cssparser::{Parser, SourcePosition};
use dom::TElement; use dom::TElement;
use log; use log;

View file

@ -277,6 +277,7 @@ impl ViewportRule {
Ok(ViewportRule { declarations: valid_declarations.iter().cascade() }) Ok(ViewportRule { declarations: valid_declarations.iter().cascade() })
} }
#[allow(unsafe_code)]
pub fn from_meta(content: &str) -> Option<ViewportRule> { pub fn from_meta(content: &str) -> Option<ViewportRule> {
let mut declarations = HashMap::new(); let mut declarations = HashMap::new();
macro_rules! push_descriptor { macro_rules! push_descriptor {
@ -458,6 +459,7 @@ impl ViewportDescriptorDeclaration {
} }
} }
#[allow(unsafe_code)]
fn cascade<'a, I>(iter: I) -> Vec<ViewportDescriptorDeclaration> fn cascade<'a, I>(iter: I) -> Vec<ViewportDescriptorDeclaration>
where I: Iterator<Item=&'a ViewportDescriptorDeclaration> where I: Iterator<Item=&'a ViewportDescriptorDeclaration>
{ {