diff options
author | Lars Bergstrom <lars@lars.com> | 2014-03-14 17:06:40 -0500 |
---|---|---|
committer | Lars Bergstrom <lars@lars.com> | 2014-03-18 22:00:48 -0500 |
commit | a6100563a6e43471ae43fb155113bc2026992f78 (patch) | |
tree | 7e7fbd7976c3da12ff463d6ffbeb1a3a336ae7d3 | |
parent | fe22598c56092880b3e947b4fc9466d1a700e17e (diff) | |
download | servo-a6100563a6e43471ae43fb155113bc2026992f78.tar.gz servo-a6100563a6e43471ae43fb155113bc2026992f78.zip |
Rust upgrade for new master rebase
39 files changed, 104 insertions, 154 deletions
diff --git a/src/components/gfx/platform/android/font.rs b/src/components/gfx/platform/android/font.rs index 26e684fc0c0..46205f57ffb 100644 --- a/src/components/gfx/platform/android/font.rs +++ b/src/components/gfx/platform/android/font.rs @@ -103,7 +103,7 @@ impl FontHandleMethods for FontHandle { let face_index = 0 as FT_Long; let result = FT_New_Memory_Face(lib, cbuf, cbuflen as FT_Long, face_index, &mut face); - + if !result.succeeded() || face.is_null() { return Err(()); } diff --git a/src/components/gfx/platform/linux/font.rs b/src/components/gfx/platform/linux/font.rs index 26e684fc0c0..46205f57ffb 100644 --- a/src/components/gfx/platform/linux/font.rs +++ b/src/components/gfx/platform/linux/font.rs @@ -103,7 +103,7 @@ impl FontHandleMethods for FontHandle { let face_index = 0 as FT_Long; let result = FT_New_Memory_Face(lib, cbuf, cbuflen as FT_Long, face_index, &mut face); - + if !result.succeeded() || face.is_null() { return Err(()); } diff --git a/src/components/gfx/render_task.rs b/src/components/gfx/render_task.rs index 66817554e1f..bb9ed1f665a 100644 --- a/src/components/gfx/render_task.rs +++ b/src/components/gfx/render_task.rs @@ -191,11 +191,9 @@ impl<C: RenderListener + Send,T:Send+Freeze> RenderTask<C,T> { render_task.start(); // Destroy all the buffers. - { - match render_task.native_graphics_context.as_ref() { - Some(ctx) => render_task.buffer_map.clear(ctx), - None => (), - } + match render_task.native_graphics_context.as_ref() { + Some(ctx) => render_task.buffer_map.clear(ctx), + None => (), } } diff --git a/src/components/gfx/text/glyph.rs b/src/components/gfx/text/glyph.rs index 04108b5bb24..f23b4d88eaf 100644 --- a/src/components/gfx/text/glyph.rs +++ b/src/components/gfx/text/glyph.rs @@ -10,7 +10,7 @@ use servo_util::geometry; use std::cmp::{Ord, Eq}; use std::num::NumCast; use std::mem; -use std::uint; +use std::u16; use std::vec; use std::iter; use geom::point::Point2D; @@ -54,7 +54,7 @@ impl GlyphEntry { // Create a GlyphEntry for uncommon case; should be accompanied by // initialization of the actual DetailedGlyph data in DetailedGlyphStore fn complex(starts_cluster: bool, starts_ligature: bool, glyph_count: uint) -> GlyphEntry { - assert!(glyph_count <= uint::MAX); + assert!(glyph_count <= u16::MAX as uint); debug!("creating complex glyph entry: starts_cluster={}, starts_ligature={}, \ glyph_count={}", @@ -78,7 +78,7 @@ impl GlyphEntry { /// Create a GlyphEntry for the case where glyphs couldn't be found for the specified /// character. fn missing(glyph_count: uint) -> GlyphEntry { - assert!(glyph_count <= uint::MAX); + assert!(glyph_count <= u16::MAX as uint); GlyphEntry::new((glyph_count as u32) << GLYPH_COUNT_SHIFT) } diff --git a/src/components/main/compositing/compositor.rs b/src/components/main/compositing/compositor.rs index d6e4203407e..70655817fee 100644 --- a/src/components/main/compositing/compositor.rs +++ b/src/components/main/compositing/compositor.rs @@ -228,7 +228,7 @@ impl IOCompositor { loop { match (self.port.try_recv(), self.shutting_down) { (Empty, _) => break, - + (Disconnected, _) => break, (Data(Exit(chan)), _) => { diff --git a/src/components/main/constellation.rs b/src/components/main/constellation.rs index 81e922500cd..4cc8aa33ccf 100644 --- a/src/components/main/constellation.rs +++ b/src/components/main/constellation.rs @@ -540,8 +540,7 @@ impl Constellation { already_sent.insert(pipeline.id); } }; - - + // If the subframe is in the current frame tree, the compositor needs the new size for current_frame in self.current_frame().iter() { debug!("Constellation: Sending size for frame in current frame tree."); diff --git a/src/components/main/css/matching.rs b/src/components/main/css/matching.rs index 407ff64d4c2..72f2936312f 100644 --- a/src/components/main/css/matching.rs +++ b/src/components/main/css/matching.rs @@ -122,7 +122,7 @@ impl<'a> Hash for ApplicableDeclarationsCacheQuery<'a> { for declaration in self.declarations.iter() { let ptr: uint = unsafe { cast::transmute_copy(declaration) - }; + }; ptr.hash(state); } } diff --git a/src/components/main/platform/common/glfw_windowing.rs b/src/components/main/platform/common/glfw_windowing.rs index ae28912427f..353c84a5acc 100644 --- a/src/components/main/platform/common/glfw_windowing.rs +++ b/src/components/main/platform/common/glfw_windowing.rs @@ -147,7 +147,7 @@ impl WindowMethods<Application> for Window { if !self.event_queue.with_mut(|queue| queue.is_empty()) { return self.event_queue.with_mut(|queue| queue.shift().unwrap()) } - + glfw::poll_events(); for (_, event) in self.glfw_window.flush_events() { self.handle_window_event(&self.glfw_window, event); diff --git a/src/components/main/servo.rs b/src/components/main/servo.rs index 1b64a6bce76..e5f919c5ccb 100755 --- a/src/components/main/servo.rs +++ b/src/components/main/servo.rs @@ -113,9 +113,6 @@ pub mod windowing; #[path="platform/mod.rs"] pub mod platform; -#[path = "util/mod.rs"] -pub mod util; - #[cfg(not(test), target_os="linux")] #[cfg(not(test), target_os="macos")] #[start] diff --git a/src/components/main/util/mod.rs b/src/components/main/util/mod.rs deleted file mode 100644 index 5534317e53f..00000000000 --- a/src/components/main/util/mod.rs +++ /dev/null @@ -1,8 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * 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/. */ - -pub use servo_util::cache; - -pub mod task; - diff --git a/src/components/main/util/task.rs b/src/components/main/util/task.rs deleted file mode 100644 index 9d6d0cbd8f0..00000000000 --- a/src/components/main/util/task.rs +++ /dev/null @@ -1,24 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * 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/. */ - -//use servo_util::task::spawn_named; -/* -pub fn spawn_listener<'a, A: Send, S: IntoMaybeOwned<'a>>(name: S, f: proc(Port<A>)) -> Chan<A> { - let (setup_po, setup_ch) = Chan::new(); - spawn_named(name, proc() { - let (po, ch) = Chan::new(); - setup_ch.send(ch); - f(po); - }); - setup_po.recv() -} - -pub fn spawn_conversation<'a, A: Send, B: Send, S: IntoMaybeOwned<'a>>(name: S, f: proc(Port<A>, Chan<B>)) -> (Port<B>, Chan<A>) { - let (from_child, to_parent) = Chan::new(); - let to_child = spawn_listener(name, |from_parent| { - f(from_parent, to_parent) - }); - (from_child, to_child) -} -*/
\ No newline at end of file diff --git a/src/components/net/image/base.rs b/src/components/net/image/base.rs index 4437f8bb95b..b7efd128c06 100644 --- a/src/components/net/image/base.rs +++ b/src/components/net/image/base.rs @@ -61,7 +61,7 @@ pub fn load_from_memory(buffer: &[u8]) -> Option<Image> { Some(Image(image.width as u32, image.height as u32, png::RGBA8, image.data)) } stb_image::ImageF32(_image) => fail!(~"HDR images not implemented"), - stb_image::Error => None + stb_image::Error(_) => None } } } diff --git a/src/components/net/image/holder.rs b/src/components/net/image/holder.rs index e10a6fa0eab..ce9ed519264 100644 --- a/src/components/net/image/holder.rs +++ b/src/components/net/image/holder.rs @@ -74,7 +74,7 @@ impl ImageHolder { // If this is the first time we've called this function, load // the image and store it for the future if self.image.is_none() { - let port = + let port = self.local_image_cache.access(|local_image_cache| { local_image_cache.get_image(&self.url) }); diff --git a/src/components/net/image_cache_task.rs b/src/components/net/image_cache_task.rs index 9634bd401c1..6c0332ab0fe 100644 --- a/src/components/net/image_cache_task.rs +++ b/src/components/net/image_cache_task.rs @@ -481,6 +481,18 @@ fn load_image_data(url: Url, resource_task: ResourceTask) -> Result<~[u8], ()> { } +pub fn spawn_listener<A: Send>(f: proc(Port<A>)) -> Chan<A> { + let (setup_port, setup_chan) = Chan::new(); + + spawn(proc() { + let (port, chan) = Chan::new(); + setup_chan.send(chan); + f(port); + }); + setup_port.recv() +} + + #[cfg(test)] mod tests { use super::*; @@ -488,11 +500,11 @@ mod tests { use resource_task; use resource_task::{ResourceTask, Metadata, start_sending}; use image::base::test_image_bin; - use util::spawn_listener; use servo_util::url::parse_url; + use std::comm::{Empty, Data, Disconnected}; fn mock_resource_task(on_load: proc(resource: Chan<resource_task::ProgressMsg>)) -> ResourceTask { - spawn_listener("mock_resource_task", proc(port: Port<resource_task::ControlMsg>) { + spawn_listener(proc(port: Port<resource_task::ControlMsg>) { loop { match port.recv() { resource_task::Load(_, response) => { @@ -564,7 +576,10 @@ mod tests { url_requested.recv(); image_cache_task.exit(); mock_resource_task.send(resource_task::Exit); - assert!(url_requested.try_recv().is_none()) + match url_requested.try_recv() { + Empty | Disconnected => (), + Data(_) => assert!(false), + }; } #[test] @@ -658,7 +673,7 @@ mod tests { let (resource_task_exited, resource_task_exited_chan) = Chan::new(); - let mock_resource_task = spawn_listener("should_not...already_available", proc(port: Port<resource_task::ControlMsg>) { + let mock_resource_task = spawn_listener(proc(port: Port<resource_task::ControlMsg>) { loop { match port.recv() { resource_task::Load(_, response) => { @@ -692,7 +707,10 @@ mod tests { // Our resource task should not have received another request for the image // because it's already cached - assert!(image_bin_sent.try_recv().is_none()); + match image_bin_sent.try_recv() { + Empty | Disconnected => (), + Data(_) => assert!(false), + } } #[test] @@ -701,7 +719,7 @@ mod tests { let (resource_task_exited, resource_task_exited_chan) = Chan::new(); - let mock_resource_task = spawn_listener("should_not...already_failed", proc(port: Port<resource_task::ControlMsg>) { + let mock_resource_task = spawn_listener(proc(port: Port<resource_task::ControlMsg>) { loop { match port.recv() { resource_task::Load(_, response) => { @@ -737,7 +755,10 @@ mod tests { // Our resource task should not have received another request for the image // because it's already cached - assert!(image_bin_sent.try_recv().is_none()); + match image_bin_sent.try_recv() { + Empty | Disconnected => (), + Data(_) => assert!(false), + } } #[test] diff --git a/src/components/net/net.rs b/src/components/net/net.rs index 407638c49e5..58c8cc05d98 100644 --- a/src/components/net/net.rs +++ b/src/components/net/net.rs @@ -33,5 +33,4 @@ pub mod data_loader; pub mod image_cache_task; pub mod local_image_cache; pub mod resource_task; -pub mod util; diff --git a/src/components/net/resource_task.rs b/src/components/net/resource_task.rs index d33738d0343..7f2e1c4adbe 100644 --- a/src/components/net/resource_task.rs +++ b/src/components/net/resource_task.rs @@ -143,18 +143,6 @@ fn create_resource_task_with_loaders(loaders: ~[(~str, LoaderTaskFactory)]) -> R ResourceManager(port, loaders).start(); }); setup_port.recv() - - // FIXME: code cloned from spawn_listener due to: - // error: internal compiler error: cannot relate bound region: ReLateBound(6270, BrNamed(syntax::ast::DefId{krate: 0u32, node: 6294u32}, a)) <= ReInfer(1) - //This message reflects a bug in the Rust compiler. - -/* - let chan = spawn_listener("ResourceManager", proc(from_client) { - // TODO: change copy to move once we can move out of closures - ResourceManager(from_client, loaders).start() - }); - chan -*/ } pub struct ResourceManager { diff --git a/src/components/net/util.rs b/src/components/net/util.rs deleted file mode 100644 index 7a8ab5bb43b..00000000000 --- a/src/components/net/util.rs +++ /dev/null @@ -1,23 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * 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/. */ - -/*use std::comm::{Chan, Port}; -use servo_util::task::spawn_named;*/ - - - // FIXME: code cloned from spawn_listener due to: - // error: internal compiler error: cannot relate bound region: ReLateBound(6270, BrNamed(syntax::ast::DefId{krate: 0u32, node: 6294u32}, a)) <= ReInfer(1) - //This message reflects a bug in the Rust compiler. - -/* -pub fn spawn_listener<'a, A: Send, S: IntoMaybeOwned<'a>>(name: S, f: proc(Port<A>)) -> Chan<A> { - let (setup_port, setup_chan) = Chan::new(); - spawn_named(name, proc() { - let (port, chan) = Chan::new(); - setup_chan.send(chan); - f(port); - }); - setup_port.recv() -} -*/
\ No newline at end of file diff --git a/src/components/script/dom/bindings/codegen/CodegenRust.py b/src/components/script/dom/bindings/codegen/CodegenRust.py index bdb5686733c..d06bfb0bc31 100644 --- a/src/components/script/dom/bindings/codegen/CodegenRust.py +++ b/src/components/script/dom/bindings/codegen/CodegenRust.py @@ -370,7 +370,7 @@ class CGMethodCall(CGThing): overloadCGThings = [] overloadCGThings.append( - CGGeneric("let argcount = cmp::min(argc,%d);" % + CGGeneric("let argcount = cmp::min(argc, %d);" % maxArgCount)) overloadCGThings.append( CGSwitch("argcount", @@ -3894,7 +3894,7 @@ class CGProxyUnwrap(CGAbstractMethod): }*/ //MOZ_ASSERT(IsProxy(obj)); let box_: *%s = cast::transmute(GetProxyPrivate(obj).to_private()); - return cast::transmute(&*box_);""" % (self.descriptor.concreteType) + return box_;""" % (self.descriptor.concreteType) class CGDOMJSProxyHandler_getOwnPropertyDescriptor(CGAbstractExternMethod): def __init__(self, descriptor): @@ -4203,7 +4203,7 @@ class CGAbstractClassHook(CGAbstractExternMethod): def definition_body_prologue(self): return """ - let this: *%s = &*unwrap::<*%s>(obj); + let this: *%s = unwrap::<*%s>(obj); """ % (self.descriptor.concreteType, self.descriptor.concreteType) def definition_body(self): diff --git a/src/components/script/dom/node.rs b/src/components/script/dom/node.rs index 03d00a058c8..dcb360e0425 100644 --- a/src/components/script/dom/node.rs +++ b/src/components/script/dom/node.rs @@ -732,6 +732,8 @@ enum CloneChildrenFlag { DoNotCloneChildren } +fn as_uintptr<T>(t: &T) -> uintptr_t { t as *T as uintptr_t } + impl Node { pub fn ancestors(&self) -> AncestorIterator { AncestorIterator { @@ -1564,7 +1566,7 @@ impl Node { match prev_text { Some(ref text_node) => { let mut prev_characterdata: JS<CharacterData> = CharacterDataCast::to(text_node); - prev_characterdata.get_mut().AppendData(characterdata.get().Data()); + let _ = prev_characterdata.get_mut().AppendData(characterdata.get().Data()); abstract_self.remove_child(&mut child); }, None => prev_text = Some(child) @@ -1685,20 +1687,18 @@ impl Node { } if lastself != lastother { - unsafe { - let abstract_uint: uintptr_t = cast::transmute(abstract_self.get()); - let other_uint: uintptr_t = cast::transmute(other.get()); - - let random = if abstract_uint < other_uint { - NodeConstants::DOCUMENT_POSITION_FOLLOWING - } else { - NodeConstants::DOCUMENT_POSITION_PRECEDING - }; - // step 3. - return random + - NodeConstants::DOCUMENT_POSITION_DISCONNECTED + - NodeConstants::DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC; - } + let abstract_uint: uintptr_t = as_uintptr(&abstract_self.get()); + let other_uint: uintptr_t = as_uintptr(&other.get()); + + let random = if abstract_uint < other_uint { + NodeConstants::DOCUMENT_POSITION_FOLLOWING + } else { + NodeConstants::DOCUMENT_POSITION_PRECEDING + }; + // step 3. + return random + + NodeConstants::DOCUMENT_POSITION_DISCONNECTED + + NodeConstants::DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC; } for child in lastself.traverse_preorder() { diff --git a/src/components/script/script_task.rs b/src/components/script/script_task.rs index 3358d250de7..e82a0e87647 100644 --- a/src/components/script/script_task.rs +++ b/src/components/script/script_task.rs @@ -893,7 +893,7 @@ impl ScriptTask { // "load" event as soon as we've finished executing all scripts parsed during // the initial load. let mut event = Event::new(&window); - let _ = event.get_mut().InitEvent(~"load", false, false); + event.get_mut().InitEvent(~"load", false, false); let doctarget = EventTargetCast::from(&document); let mut wintarget: JS<EventTarget> = EventTargetCast::from(&window); let winclone = wintarget.clone(); @@ -1131,7 +1131,7 @@ impl ScriptTask { } else { let ConstellationChan(ref chan) = self.constellation_chan; chan.send(LoadUrlMsg(page.id, url)); - } + } } } } diff --git a/src/components/style/properties.rs.mako b/src/components/style/properties.rs.mako index 0a8743d035b..599eaf7bb8d 100644 --- a/src/components/style/properties.rs.mako +++ b/src/components/style/properties.rs.mako @@ -6,7 +6,6 @@ #[allow(non_camel_case_types)]; -use std::ascii::StrAsciiExt; pub use servo_util::url::parse_url; use sync::Arc; pub use extra::url::Url; @@ -340,7 +339,7 @@ pub mod longhands { &Dimension(ref value, ref unit) if value.value >= 0. => specified::Length::parse_dimension(value.value, unit.as_slice()) .map(SpecifiedLength), - &Ident(ref value) if unsafe { value.to_ascii_nocheck().to_lower().eq_ignore_case("normal".to_ascii_nocheck())} + &Ident(ref value) if unsafe { value.to_ascii_nocheck().eq_ignore_case("normal".to_ascii_nocheck())} => Some(SpecifiedNormal), _ => None, } @@ -472,7 +471,7 @@ pub mod longhands { "normal" => return Some(normal), "none" => return Some(none), - _ => () + _ => () } } }, @@ -514,7 +513,7 @@ pub mod longhands { let image_url = parse_url(url.as_slice(), Some(base_url.clone())); Some(Some(image_url)) }, - &ast::Ident(ref value) if "none" == value.to_ascii_lower() => Some(None), + &ast::Ident(ref value) if unsafe {value.to_ascii_nocheck()}.eq_ignore_case(unsafe {"none".to_ascii_nocheck()}) => Some(None), _ => None, } } @@ -978,7 +977,7 @@ pub mod shorthands { // font-style, font-weight and font-variant. // Leaves the values to None, 'normal' is the initial value for each of them. if get_ident_lower(component_value).filtered( - |v| unsafe { v.to_ascii_nocheck() }.to_lower().eq_ignore_case(unsafe {"normal".to_ascii_nocheck()})).is_some() { + |v| unsafe { v.to_ascii_nocheck() }.eq_ignore_case(unsafe {"normal".to_ascii_nocheck()})).is_some() { nb_normals += 1; continue; } @@ -1131,7 +1130,8 @@ impl PropertyDeclaration { result_list: &mut ~[PropertyDeclaration], base_url: &Url) -> PropertyDeclarationParseResult { // FIXME: local variable to work around Rust #10683 - let name_lower = name.to_ascii_lower(); + let tmp_for_lifetime = unsafe {name.to_ascii_nocheck()}.to_lower(); + let name_lower = tmp_for_lifetime.as_str_ascii(); match name_lower.as_slice() { % for property in LONGHANDS: "${property.name}" => result_list.push(${property.ident}_declaration( diff --git a/src/components/style/selector_matching.rs b/src/components/style/selector_matching.rs index 4c0f6a7898d..650300f00bb 100644 --- a/src/components/style/selector_matching.rs +++ b/src/components/style/selector_matching.rs @@ -869,7 +869,7 @@ fn matches_last_child<E:TElement,N:TNode<E>>(element: &N) -> bool { #[cfg(test)] mod tests { - use extra::arc::Arc; + use sync::Arc; use super::{MatchedProperty, Rule, SelectorMap}; /// Helper method to get some Rules from selector strings. diff --git a/src/components/style/selectors.rs b/src/components/style/selectors.rs index 0b79ef9ae20..6b7ea7e3306 100644 --- a/src/components/style/selectors.rs +++ b/src/components/style/selectors.rs @@ -577,7 +577,7 @@ fn skip_whitespace(iter: &mut Iter) -> bool { #[cfg(test)] mod tests { - use extra::arc::Arc; + use sync::Arc; use cssparser; use servo_util::namespace; use namespaces::NamespaceMap; diff --git a/src/components/util/cache.rs b/src/components/util/cache.rs index dc384baf26a..3eb37145df7 100644 --- a/src/components/util/cache.rs +++ b/src/components/util/cache.rs @@ -9,6 +9,9 @@ use std::rand; use std::vec::Items; use std::vec; +#[cfg(test)] +use std::cell::Cell; + pub trait Cache<K: Eq, V: Clone> { fn insert(&mut self, key: K, value: V); fn find(&mut self, key: &K) -> Option<V>; @@ -57,8 +60,8 @@ impl<K: Clone + Eq, V: Clone> Cache<K,V> for MonoCache<K,V> { #[test] fn test_monocache() { let mut cache = MonoCache::new(10); - let one = ~"one"; - let two = ~"two"; + let one = Cell::new("one"); + let two = Cell::new("two"); cache.insert(1, one); assert!(cache.find(&1).is_some()); @@ -104,8 +107,8 @@ impl<K: Clone + Eq + Hash, V: Clone> Cache<K,V> for HashCache<K,V> { #[test] fn test_hashcache() { let mut cache = HashCache::new(); - let one = ~"one"; - let two = ~"two"; + let one = Cell::new("one"); + let two = Cell::new("two"); cache.insert(1, one); assert!(cache.find(&1).is_some()); @@ -244,10 +247,10 @@ impl<K:Clone+Eq+Hash,V:Clone> Cache<K,V> for SimpleHashCache<K,V> { #[test] fn test_lru_cache() { - let one = ~"one"; - let two = ~"two"; - let three = ~"three"; - let four = ~"four"; + let one = Cell::new("one"); + let two = Cell::new("two"); + let three = Cell::new("three"); + let four = Cell::new("four"); // Test normal insertion. let mut cache = LRUCache::new(2); // (_, _) (cache is empty) diff --git a/src/components/util/concurrentmap.rs b/src/components/util/concurrentmap.rs index 72846fa69cf..a4ca68706b1 100644 --- a/src/components/util/concurrentmap.rs +++ b/src/components/util/concurrentmap.rs @@ -482,7 +482,7 @@ impl<'a,K,V> Iterator<(&'a K, &'a V)> for ConcurrentHashMapIterator<'a,K,V> { #[cfg(test)] pub mod test { - use extra::arc::Arc; + use sync::Arc; use native; use concurrentmap::ConcurrentHashMap; @@ -490,7 +490,7 @@ pub mod test { #[test] pub fn smoke() { let m = Arc::new(ConcurrentHashMap::new()); - let (port, chan) = SharedChan::new(); + let (port, chan) = Chan::new(); // Big enough to make it resize once. for i in range(0, 5) { diff --git a/src/components/util/geometry.rs b/src/components/util/geometry.rs index f46f9a8f4f7..e02bb8a6bb9 100644 --- a/src/components/util/geometry.rs +++ b/src/components/util/geometry.rs @@ -34,13 +34,13 @@ impl Eq for Au { fn eq(&self, other: &Au) -> bool { let Au(s) = *self; let Au(o) = *other; - s==o + s == o } #[inline] fn ne(&self, other: &Au) -> bool { let Au(s) = *self; let Au(o) = *other; - s!=o + s != o } } @@ -49,7 +49,7 @@ impl Add<Au,Au> for Au { fn add(&self, other: &Au) -> Au { let Au(s) = *self; let Au(o) = *other; - Au(s+o) + Au(s + o) } } @@ -58,7 +58,7 @@ impl Sub<Au,Au> for Au { fn sub(&self, other: &Au) -> Au { let Au(s) = *self; let Au(o) = *other; - Au(s-o) + Au(s - o) } } @@ -68,7 +68,7 @@ impl Mul<Au,Au> for Au { fn mul(&self, other: &Au) -> Au { let Au(s) = *self; let Au(o) = *other; - Au(s*o) + Au(s * o) } } @@ -77,7 +77,7 @@ impl Div<Au,Au> for Au { fn div(&self, other: &Au) -> Au { let Au(s) = *self; let Au(o) = *other; - Au(s/o) + Au(s / o) } } @@ -86,7 +86,7 @@ impl Rem<Au,Au> for Au { fn rem(&self, other: &Au) -> Au { let Au(s) = *self; let Au(o) = *other; - Au(s%o) + Au(s % o) } } @@ -103,25 +103,25 @@ impl Ord for Au { fn lt(&self, other: &Au) -> bool { let Au(s) = *self; let Au(o) = *other; - s<o + s < o } #[inline] fn le(&self, other: &Au) -> bool { let Au(s) = *self; let Au(o) = *other; - s<=o + s <= o } #[inline] fn ge(&self, other: &Au) -> bool { let Au(s) = *self; let Au(o) = *other; - s>=o + s >= o } #[inline] fn gt(&self, other: &Au) -> bool { let Au(s) = *self; let Au(o) = *other; - s>o + s > o } } @@ -136,7 +136,7 @@ impl Zero for Au { #[inline] fn is_zero(&self) -> bool { let Au(s) = *self; - s==0 + s == 0 } } @@ -239,7 +239,7 @@ impl Au { let Au(yi) = y; if xi < yi { x } else { y } } - + #[inline] pub fn max(x: Au, y: Au) -> Au { let Au(xi) = x; diff --git a/src/platform/linux/rust-fontconfig b/src/platform/linux/rust-fontconfig -Subproject 27bd48201ba241704b65f808b703b688a53af18 +Subproject fbbb7c93c09ba20e827bdb20506da2b6c9d901c diff --git a/src/platform/linux/rust-freetype b/src/platform/linux/rust-freetype -Subproject cac56f2e41ee8c9473f5ef59963ff5ea5b3e93e +Subproject 1c583b83da60bf4bb1a002075282d6918441929 diff --git a/src/platform/linux/rust-xlib b/src/platform/linux/rust-xlib -Subproject c993ff32e12b37cc3c4559d2442aa497a8f1c31 +Subproject 520b19313f4a684caf3c519d685a93d83479ee6 diff --git a/src/support/azure/rust-azure b/src/support/azure/rust-azure -Subproject 3b1f121175faccc05cd60387b06cbe2cd4355ec +Subproject 8c1cbd6817241e7f13a985a79a904f1cfac7899 diff --git a/src/support/css/rust-cssparser b/src/support/css/rust-cssparser -Subproject b03ed6b97ddc489690c58b057e508c41f2ed59b +Subproject eb5dd25933f521b0a1bfdd26da1f9e7fff27a26 diff --git a/src/support/glut/rust-glut b/src/support/glut/rust-glut -Subproject beb749916d07c16892cdc18f188bbc8fc2f22e7 +Subproject 71e97b1e9f5f93d0f4aa3ec4b6d271b55e1055f diff --git a/src/support/layers/rust-layers b/src/support/layers/rust-layers -Subproject 91a8a1a967e55ba03e710f6eaa56cf91e702dff +Subproject c29c94e8e14a87e3184d0273e025308d5d0a316 diff --git a/src/support/png/rust-png b/src/support/png/rust-png -Subproject b52d5496184a99a329f4eee96b9d57b810acbb0 +Subproject 3c4f326b0ddd7bf47966facb56c40d76bfb6cec diff --git a/src/support/sharegl/sharegl b/src/support/sharegl/sharegl -Subproject 4c25d24081ceb22f36244843e5e506bfaa481d0 +Subproject b19f248d8ef71f2c762ec41d8ed6b67cd330926 diff --git a/src/support/spidermonkey/rust-mozjs b/src/support/spidermonkey/rust-mozjs -Subproject 0dc0704215de008081d96a2a82dd5cc2143d7b7 +Subproject c94949f8c567e17c1594931ec62c7857ed24b04 diff --git a/src/support/stb-image/rust-stb-image b/src/support/stb-image/rust-stb-image -Subproject 626605f83c3451e8458de04c1c516d6fc706969 +Subproject fb4c04ac4caf9406b117f31df04fe8567f56b66 diff --git a/src/test/content/test_document_body.html b/src/test/content/test_document_body.html index e10447bc588..3ddf6b8a16b 100644 --- a/src/test/content/test_document_body.html +++ b/src/test/content/test_document_body.html @@ -36,7 +36,7 @@ is_not(new_div, null, "test4-0, append an invalid element to a new document"); should_throw(function() { - new_document.body = new_div; + new_document.body = new_div; }); is(new_document.body, null, "test4-1, append an invalid element to a new document"); } diff --git a/src/test/harness/reftest/reftest.rs b/src/test/harness/reftest/reftest.rs index 46628a695b6..bec7d41a76c 100644 --- a/src/test/harness/reftest/reftest.rs +++ b/src/test/harness/reftest/reftest.rs @@ -69,13 +69,13 @@ fn parse_lists(filenames: &[~str], servo_args: &[~str]) -> ~[TestDescAndFn] { let mut next_id = 0; for file in filenames.iter() { let file_path = Path::new(file.clone()); - let contents = match File::open_mode(&file_path, io::Open, io::Read) { - Ok(mut f) => str::from_utf8_owned(match f.read_to_end() { - Ok(s) => s, + let contents = match File::open_mode(&file_path, io::Open, io::Read) + .and_then(|mut f| { + f.read_to_end() + }) { + Ok(s) => str::from_utf8_owned(s), _ => fail!("Could not read file"), - }), - _ => fail!("Could not convert file") - }; + }; for line in contents.unwrap().lines() { // ignore comments @@ -149,7 +149,7 @@ fn check_reftest(reftest: Reftest) { let right = capture(&reftest, 1); let pixels: ~[u8] = left.pixels.iter().zip(right.pixels.iter()).map(|(&a, &b)| { - if (a as i8 - b as i8 == 0) { + if a as i8 - b as i8 == 0 { // White for correct 0xFF } else { |