diff options
Diffstat (limited to 'components/script/dom/bindings')
-rw-r--r-- | components/script/dom/bindings/import.rs | 2 | ||||
-rw-r--r-- | components/script/dom/bindings/root.rs | 32 |
2 files changed, 3 insertions, 31 deletions
diff --git a/components/script/dom/bindings/import.rs b/components/script/dom/bindings/import.rs index 34ac97fd31a..f2c6a5e2b81 100644 --- a/components/script/dom/bindings/import.rs +++ b/components/script/dom/bindings/import.rs @@ -2,6 +2,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ +#[allow(unused_imports)] pub mod base { pub use std::ptr; pub use std::rc::Rc; @@ -41,6 +42,7 @@ pub mod base { pub use crate::script_runtime::JSContext as SafeJSContext; } +#[allow(unused_imports)] pub mod module { pub use std::cmp; pub use std::ffi::CString; diff --git a/components/script/dom/bindings/root.rs b/components/script/dom/bindings/root.rs index de325707ee5..f9b302fab5f 100644 --- a/components/script/dom/bindings/root.rs +++ b/components/script/dom/bindings/root.rs @@ -31,8 +31,7 @@ use std::marker::PhantomData; use std::ops::Deref; use std::{mem, ptr}; -use js::jsapi::{Heap, JSObject, JSTracer}; -use js::rust::GCMethods; +use js::jsapi::{JSObject, JSTracer}; use malloc_size_of::{MallocSizeOf, MallocSizeOfOps}; use script_layout_interface::TrustedNodeAddress; use style::thread_state; @@ -772,32 +771,3 @@ where &*(slice as *const [Dom<T>] as *const [LayoutDom<T>]) } } - -/// Helper trait for safer manipulations of `Option<Heap<T>>` values. -pub trait OptionalHeapSetter { - type Value; - /// Update this optional heap value with a new value. - fn set(&mut self, v: Option<Self::Value>); -} - -impl<T: GCMethods + Copy> OptionalHeapSetter for Option<Heap<T>> -where - Heap<T>: Default, -{ - type Value = T; - fn set(&mut self, v: Option<T>) { - let v = match v { - None => { - *self = None; - return; - }, - Some(v) => v, - }; - - if self.is_none() { - *self = Some(Heap::default()); - } - - self.as_ref().unwrap().set(v); - } -} |