diff options
author | bors-servo <metajack+bors@gmail.com> | 2015-01-08 16:03:55 -0700 |
---|---|---|
committer | bors-servo <metajack+bors@gmail.com> | 2015-01-08 16:03:55 -0700 |
commit | 0793137631cbe4ebbff8fb85639206ce8e41bbb7 (patch) | |
tree | 5cff1d8f69de810dd2adf4957cdd2cc104adbf61 /components/script | |
parent | 1699864f5339aaf463df5e2cf1d80193c3675e58 (diff) | |
parent | 020a767849e9979649909a1c7c3052524fd7bae2 (diff) | |
download | servo-0793137631cbe4ebbff8fb85639206ce8e41bbb7.tar.gz servo-0793137631cbe4ebbff8fb85639206ce8e41bbb7.zip |
auto merge of #4575 : mttr/servo/warnings, r=jdm
Notes:
* This adds `#![allow(missing_copy_implementations)]` to components/*/lib.rs. I'm not sure how to approach the missing Copy warnings (are there things for which Copy should NOT be implemented, and how can I tell?) so I stuck this in to make life easier when looking through the warnings. I can easily remove this if necessary.
* This leaves the following type of warnings, which I couldn't figure out how to approach (I'll investigate it later if no one else wants to).
```
css/matching.rs:72:23: 72:35 warning: use of deprecated item: Use overloaded core::cmp::PartialEq, #[warn(deprecated)] on by default
css/matching.rs:72 this_as_query.equiv(other)
^~~~~~~~~~~~
css/matching.rs:95:10: 95:49 warning: use of deprecated item: Use overloaded core::cmp::PartialEq, #[warn(deprecated)] on by default
css/matching.rs:95 impl<'a> Equiv<ApplicableDeclarationsCacheEntry> for ApplicableDeclarationsCacheQuery<'a> {
```
Diffstat (limited to 'components/script')
-rw-r--r-- | components/script/dom/bindings/conversions.rs | 21 | ||||
-rw-r--r-- | components/script/dom/bindings/js.rs | 6 | ||||
-rw-r--r-- | components/script/dom/bindings/refcounted.rs | 10 | ||||
-rw-r--r-- | components/script/dom/eventtarget.rs | 4 | ||||
-rw-r--r-- | components/script/dom/formdata.rs | 4 | ||||
-rw-r--r-- | components/script/dom/htmlformelement.rs | 2 | ||||
-rw-r--r-- | components/script/dom/node.rs | 2 | ||||
-rw-r--r-- | components/script/dom/urlsearchparams.rs | 4 | ||||
-rw-r--r-- | components/script/dom/xmlhttprequest.rs | 2 | ||||
-rw-r--r-- | components/script/lib.rs | 1 | ||||
-rw-r--r-- | components/script/script_task.rs | 6 |
11 files changed, 31 insertions, 31 deletions
diff --git a/components/script/dom/bindings/conversions.rs b/components/script/dom/bindings/conversions.rs index ddfff41f8f5..8e9e656b0c4 100644 --- a/components/script/dom/bindings/conversions.rs +++ b/components/script/dom/bindings/conversions.rs @@ -272,9 +272,8 @@ pub fn jsstring_to_str(cx: *mut JSContext, s: *mut JSString) -> DOMString { unsafe { let mut length = 0; let chars = JS_GetStringCharsAndLength(cx, s, &mut length); - slice::raw::buf_as_slice(chars, length as uint, |char_vec| { - String::from_utf16(char_vec).unwrap() - }) + let char_vec = slice::from_raw_buf(&chars, length as uint); + String::from_utf16(char_vec).unwrap() } } @@ -328,14 +327,14 @@ impl FromJSValConvertible<()> for ByteString { let mut length = 0; let chars = JS_GetStringCharsAndLength(cx, string, &mut length); - slice::raw::buf_as_slice(chars, length as uint, |char_vec| { - if char_vec.iter().any(|&c| c > 0xFF) { - // XXX Throw - Err(()) - } else { - Ok(ByteString::new(char_vec.iter().map(|&c| c as u8).collect())) - } - }) + let char_vec = slice::from_raw_buf(&chars, length as uint); + + if char_vec.iter().any(|&c| c > 0xFF) { + // XXX Throw + Err(()) + } else { + Ok(ByteString::new(char_vec.iter().map(|&c| c as u8).collect())) + } } } } diff --git a/components/script/dom/bindings/js.rs b/components/script/dom/bindings/js.rs index a0c099769f0..ac8da0f8ba6 100644 --- a/components/script/dom/bindings/js.rs +++ b/components/script/dom/bindings/js.rs @@ -51,7 +51,7 @@ use dom::node::Node; use js::jsapi::JSObject; use js::jsval::JSVal; use layout_interface::TrustedNodeAddress; -use script_task::StackRoots; +use script_task::STACK_ROOTS; use servo_util::smallvec::{SmallVec, SmallVec16}; use std::cell::{Cell, UnsafeCell}; @@ -101,7 +101,7 @@ impl<T: Reflectable> Temporary<T> { /// Create a stack-bounded root for this value. pub fn root(self) -> Root<T> { - StackRoots.with(|ref collection| { + STACK_ROOTS.with(|ref collection| { let RootCollectionPtr(collection) = collection.get().unwrap(); unsafe { Root::new(&*collection, &self.inner) @@ -164,7 +164,7 @@ impl<T: Reflectable> JS<T> { /// Root this JS-owned value to prevent its collection as garbage. pub fn root(&self) -> Root<T> { - StackRoots.with(|ref collection| { + STACK_ROOTS.with(|ref collection| { let RootCollectionPtr(collection) = collection.get().unwrap(); unsafe { Root::new(&*collection, self) diff --git a/components/script/dom/bindings/refcounted.rs b/components/script/dom/bindings/refcounted.rs index 1f6149394f2..adf7d71fde5 100644 --- a/components/script/dom/bindings/refcounted.rs +++ b/components/script/dom/bindings/refcounted.rs @@ -36,7 +36,7 @@ use std::collections::hash_map::{HashMap, Vacant, Occupied}; use std::rc::Rc; use std::sync::{Arc, Mutex}; -thread_local!(pub static LiveReferences: Rc<RefCell<Option<LiveDOMReferences>>> = Rc::new(RefCell::new(None))) +thread_local!(pub static LIVE_REFERENCES: Rc<RefCell<Option<LiveDOMReferences>>> = Rc::new(RefCell::new(None))) /// A safe wrapper around a raw pointer to a DOM object that can be @@ -57,7 +57,7 @@ impl<T: Reflectable> Trusted<T> { /// be prevented from being GCed for the duration of the resulting `Trusted<T>` object's /// lifetime. pub fn new(cx: *mut JSContext, ptr: JSRef<T>, script_chan: Box<ScriptChan + Send>) -> Trusted<T> { - LiveReferences.with(|ref r| { + LIVE_REFERENCES.with(|ref r| { let r = r.borrow(); let live_references = r.as_ref().unwrap(); let refcount = live_references.addref(cx, &*ptr as *const T); @@ -74,7 +74,7 @@ impl<T: Reflectable> Trusted<T> { /// a different thread than the original value from which this `Trusted<T>` was /// obtained. pub fn to_temporary(&self) -> Temporary<T> { - assert!(LiveReferences.with(|ref r| { + assert!(LIVE_REFERENCES.with(|ref r| { let r = r.borrow(); let live_references = r.as_ref().unwrap(); self.owner_thread == (&*live_references) as *const _ as *const libc::c_void @@ -123,7 +123,7 @@ pub struct LiveDOMReferences { impl LiveDOMReferences { /// Set up the task-local data required for storing the outstanding DOM references. pub fn initialize() { - LiveReferences.with(|ref r| { + LIVE_REFERENCES.with(|ref r| { *r.borrow_mut() = Some(LiveDOMReferences { table: RefCell::new(HashMap::new()), }) @@ -152,7 +152,7 @@ impl LiveDOMReferences { /// Unpin the given DOM object if its refcount is 0. pub fn cleanup(cx: *mut JSContext, raw_reflectable: *const libc::c_void) { - LiveReferences.with(|ref r| { + LIVE_REFERENCES.with(|ref r| { let r = r.borrow(); let live_references = r.as_ref().unwrap(); let reflectable = raw_reflectable as *const Reflector; diff --git a/components/script/dom/eventtarget.rs b/components/script/dom/eventtarget.rs index bc78affcc6c..e266306f627 100644 --- a/components/script/dom/eventtarget.rs +++ b/components/script/dom/eventtarget.rs @@ -87,14 +87,14 @@ impl EventTarget { } pub fn get_listeners(&self, type_: &str) -> Option<Vec<EventListener>> { - self.handlers.borrow().find_equiv(type_).map(|listeners| { + self.handlers.borrow().get(type_).map(|listeners| { listeners.iter().map(|entry| entry.listener.get_listener()).collect() }) } pub fn get_listeners_for(&self, type_: &str, desired_phase: ListenerPhase) -> Option<Vec<EventListener>> { - self.handlers.borrow().find_equiv(type_).map(|listeners| { + self.handlers.borrow().get(type_).map(|listeners| { let filtered = listeners.iter().filter(|entry| entry.phase == desired_phase); filtered.map(|entry| entry.listener.get_listener()).collect() }) diff --git a/components/script/dom/formdata.rs b/components/script/dom/formdata.rs index 42a495686ed..bcac91da97e 100644 --- a/components/script/dom/formdata.rs +++ b/components/script/dom/formdata.rs @@ -81,7 +81,7 @@ impl<'a> FormDataMethods for JSRef<'a, FormData> { } fn Get(self, name: DOMString) -> Option<FileOrString> { - if self.data.borrow().contains_key_equiv(&name) { + if self.data.borrow().contains_key(&name) { match (*self.data.borrow())[name][0].clone() { FormDatum::StringData(ref s) => Some(eString(s.clone())), FormDatum::FileData(ref f) => { @@ -94,7 +94,7 @@ impl<'a> FormDataMethods for JSRef<'a, FormData> { } fn Has(self, name: DOMString) -> bool { - self.data.borrow().contains_key_equiv(&name) + self.data.borrow().contains_key(&name) } #[allow(unrooted_must_root)] fn Set(self, name: DOMString, value: JSRef<Blob>, filename: Option<DOMString>) { diff --git a/components/script/dom/htmlformelement.rs b/components/script/dom/htmlformelement.rs index 33313116161..fc8f9879c7b 100644 --- a/components/script/dom/htmlformelement.rs +++ b/components/script/dom/htmlformelement.rs @@ -246,7 +246,7 @@ impl<'a> HTMLFormElementHelpers for JSRef<'a, HTMLFormElement> { let node: JSRef<Node> = NodeCast::from_ref(self); // TODO: This is an incorrect way of getting controls owned // by the form, but good enough until html5ever lands - let mut data_set = node.traverse_preorder().filter_map(|child| { + let data_set = node.traverse_preorder().filter_map(|child| { if child.get_disabled_state() { return None; } diff --git a/components/script/dom/node.rs b/components/script/dom/node.rs index 155e3cb0fa8..849f912bf35 100644 --- a/components/script/dom/node.rs +++ b/components/script/dom/node.rs @@ -782,7 +782,7 @@ impl<'a> NodeHelpers<'a> for JSRef<'a, Node> { fn query_selector_all(self, selectors: DOMString) -> Fallible<Temporary<NodeList>> { // Step 1. unsafe { - self.query_selector_iter(selectors).map(|mut iter| { + self.query_selector_iter(selectors).map(|iter| { let window = window_from_node(self).root(); NodeList::new_simple_list(window.r(), iter.collect()) }) diff --git a/components/script/dom/urlsearchparams.rs b/components/script/dom/urlsearchparams.rs index fc1edbcdc1e..035e558d878 100644 --- a/components/script/dom/urlsearchparams.rs +++ b/components/script/dom/urlsearchparams.rs @@ -80,11 +80,11 @@ impl<'a> URLSearchParamsMethods for JSRef<'a, URLSearchParams> { } fn Get(self, name: DOMString) -> Option<DOMString> { - self.data.borrow().find_equiv(&name).map(|v| v[0].clone()) + self.data.borrow().get(&name).map(|v| v[0].clone()) } fn Has(self, name: DOMString) -> bool { - self.data.borrow().contains_key_equiv(&name) + self.data.borrow().contains_key(&name) } fn Set(self, name: DOMString, value: DOMString) { diff --git a/components/script/dom/xmlhttprequest.rs b/components/script/dom/xmlhttprequest.rs index a83cc59ac7b..79349cbf674 100644 --- a/components/script/dom/xmlhttprequest.rs +++ b/components/script/dom/xmlhttprequest.rs @@ -923,7 +923,7 @@ impl<'a> PrivateXMLHttpRequestHelpers for JSRef<'a, XMLHttpRequest> { fn dispatch_response_progress_event(self, type_: DOMString) { let len = self.response.borrow().len() as u64; - let total = self.response_headers.borrow().get::<ContentLength>().map(|x| {x.len() as u64}); + let total = self.response_headers.borrow().get::<ContentLength>().map(|x| {**x as u64}); self.dispatch_progress_event(false, type_, len, total); } fn set_timeout(self, timeout: u32) { diff --git a/components/script/lib.rs b/components/script/lib.rs index 7cd7ab6bb52..33610bb1b6b 100644 --- a/components/script/lib.rs +++ b/components/script/lib.rs @@ -7,6 +7,7 @@ #![deny(unused_imports)] #![deny(unused_variables)] #![allow(non_snake_case)] +#![allow(missing_copy_implementations)] #![doc="The script crate contains all matters DOM."] diff --git a/components/script/script_task.rs b/components/script/script_task.rs index faefda42904..cb757d97f93 100644 --- a/components/script/script_task.rs +++ b/components/script/script_task.rs @@ -85,7 +85,7 @@ use std::rc::Rc; use std::u32; use time::{Tm, strptime}; -thread_local!(pub static StackRoots: Cell<Option<RootCollectionPtr>> = Cell::new(None)) +thread_local!(pub static STACK_ROOTS: Cell<Option<RootCollectionPtr>> = Cell::new(None)) #[deriving(Copy)] pub enum TimerSource { @@ -161,7 +161,7 @@ pub struct StackRootTLS; impl StackRootTLS { pub fn new(roots: &RootCollection) -> StackRootTLS { - StackRoots.with(|ref r| { + STACK_ROOTS.with(|ref r| { r.set(Some(RootCollectionPtr(roots as *const _))) }); StackRootTLS @@ -170,7 +170,7 @@ impl StackRootTLS { impl Drop for StackRootTLS { fn drop(&mut self) { - StackRoots.with(|ref r| r.set(None)); + STACK_ROOTS.with(|ref r| r.set(None)); } } |