Update script to work with lint changes

This commit is contained in:
Manish Goregaokar 2015-10-15 18:47:04 +05:30
parent 7022bedba3
commit 8819f0d8b8
6 changed files with 12 additions and 5 deletions

View file

@ -210,6 +210,7 @@ impl GlobalRoot {
impl GlobalField { impl GlobalField {
/// Create a new `GlobalField` from a rooted reference. /// Create a new `GlobalField` from a rooted reference.
#[allow(unrooted_must_root)]
pub fn from_rooted(global: &GlobalRef) -> GlobalField { pub fn from_rooted(global: &GlobalRef) -> GlobalField {
match *global { match *global {
GlobalRef::Window(window) => GlobalField::Window(JS::from_ref(window)), GlobalRef::Window(window) => GlobalField::Window(JS::from_ref(window)),

View file

@ -67,12 +67,14 @@ impl<T: Reflectable> JS<T> {
} }
/// Create a JS<T> from a Root<T> /// Create a JS<T> from a Root<T>
/// XXX Not a great API. Should be a call on Root<T> instead /// XXX Not a great API. Should be a call on Root<T> instead
#[allow(unrooted_must_root)]
pub fn from_rooted(root: &Root<T>) -> JS<T> { pub fn from_rooted(root: &Root<T>) -> JS<T> {
JS { JS {
ptr: unsafe { NonZero::new(&**root) } ptr: unsafe { NonZero::new(&**root) }
} }
} }
/// Create a JS<T> from a &T /// Create a JS<T> from a &T
#[allow(unrooted_must_root)]
pub fn from_ref(obj: &T) -> JS<T> { pub fn from_ref(obj: &T) -> JS<T> {
JS { JS {
ptr: unsafe { NonZero::new(&*obj) } ptr: unsafe { NonZero::new(&*obj) }
@ -125,6 +127,7 @@ impl<T> PartialEq for LayoutJS<T> {
impl <T> Clone for JS<T> { impl <T> Clone for JS<T> {
#[inline] #[inline]
#[allow(unrooted_must_root)]
fn clone(&self) -> JS<T> { fn clone(&self) -> JS<T> {
JS { JS {
ptr: self.ptr.clone() ptr: self.ptr.clone()
@ -288,6 +291,7 @@ impl<T: Reflectable> MutNullableHeap<JS<T>> {
} }
impl<T: HeapGCValue + Copy> Default for MutNullableHeap<T> { impl<T: HeapGCValue + Copy> Default for MutNullableHeap<T> {
#[allow(unrooted_must_root)]
fn default() -> MutNullableHeap<T> { fn default() -> MutNullableHeap<T> {
MutNullableHeap { MutNullableHeap {
ptr: Cell::new(None) ptr: Cell::new(None)

View file

@ -1352,10 +1352,12 @@ impl Node {
Node::new_(flags, Some(doc)) Node::new_(flags, Some(doc))
} }
#[allow(unrooted_must_root)]
pub fn new_document_node() -> Node { pub fn new_document_node() -> Node {
Node::new_(NodeFlags::new() | IS_IN_DOC, None) Node::new_(NodeFlags::new() | IS_IN_DOC, None)
} }
#[allow(unrooted_must_root)]
fn new_(flags: NodeFlags, doc: Option<&Document>) -> Node { fn new_(flags: NodeFlags, doc: Option<&Document>) -> Node {
Node { Node {
eventtarget: EventTarget::new_inherited(), eventtarget: EventTarget::new_inherited(),

View file

@ -43,6 +43,7 @@ pub struct Sink {
} }
impl Sink { impl Sink {
#[allow(unrooted_must_root)] // method is only run at parse time
pub fn get_or_create(&self, child: NodeOrText<JS<Node>>) -> Root<Node> { pub fn get_or_create(&self, child: NodeOrText<JS<Node>>) -> Root<Node> {
match child { match child {
NodeOrText::AppendNode(n) => n.root(), NodeOrText::AppendNode(n) => n.root(),

View file

@ -147,10 +147,10 @@ impl WebGLRenderingContext {
} }
} }
pub fn bound_texture_for(&self, target: u32) -> Option<JS<WebGLTexture>> { pub fn bound_texture_for(&self, target: u32) -> Option<Root<WebGLTexture>> {
match target { match target {
constants::TEXTURE_2D => self.bound_texture_2d.get(), constants::TEXTURE_2D => self.bound_texture_2d.get().map(|t| t.root()),
constants::TEXTURE_CUBE_MAP => self.bound_texture_cube_map.get(), constants::TEXTURE_CUBE_MAP => self.bound_texture_cube_map.get().map(|t| t.root()),
_ => unreachable!(), _ => unreachable!(),
} }
@ -906,7 +906,6 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
constants::TEXTURE_2D | constants::TEXTURE_2D |
constants::TEXTURE_CUBE_MAP => { constants::TEXTURE_CUBE_MAP => {
if let Some(texture) = self.bound_texture_for(target) { if let Some(texture) = self.bound_texture_for(target) {
let texture = texture.root();
let result = texture.r().tex_parameter(target, name, TexParameterValue::Float(value)); let result = texture.r().tex_parameter(target, name, TexParameterValue::Float(value));
handle_potential_webgl_error!(self, result); handle_potential_webgl_error!(self, result);
} else { } else {
@ -924,7 +923,6 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
constants::TEXTURE_2D | constants::TEXTURE_2D |
constants::TEXTURE_CUBE_MAP => { constants::TEXTURE_CUBE_MAP => {
if let Some(texture) = self.bound_texture_for(target) { if let Some(texture) = self.bound_texture_for(target) {
let texture = texture.root();
let result = texture.r().tex_parameter(target, name, TexParameterValue::Int(value)); let result = texture.r().tex_parameter(target, name, TexParameterValue::Int(value));
handle_potential_webgl_error!(self, result); handle_potential_webgl_error!(self, result);
} else { } else {

View file

@ -119,6 +119,7 @@ impl Page {
old old
} }
#[allow(unrooted_must_root)]
pub fn set_frame(&self, frame: Option<Frame>) { pub fn set_frame(&self, frame: Option<Frame>) {
*self.frame.borrow_mut() = frame; *self.frame.borrow_mut() = frame;
} }