mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
Rust upgrade for new master rebase
This commit is contained in:
parent
fe22598c56
commit
a6100563a6
39 changed files with 115 additions and 165 deletions
|
@ -191,13 +191,11 @@ 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 => (),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
debug!("render_task: shutdown_chan send");
|
||||
shutdown_chan.send(());
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
|
|
@ -541,7 +541,6 @@ impl Constellation {
|
|||
}
|
||||
};
|
||||
|
||||
|
||||
// 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.");
|
||||
|
|
|
@ -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]
|
||||
|
|
|
@ -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;
|
||||
|
|
@ -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)
|
||||
}
|
||||
*/
|
|
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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]
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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()
|
||||
}
|
||||
*/
|
|
@ -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):
|
||||
|
|
|
@ -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,9 +1687,8 @@ 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 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
|
||||
|
@ -1699,7 +1700,6 @@ impl Node {
|
|||
NodeConstants::DOCUMENT_POSITION_DISCONNECTED +
|
||||
NodeConstants::DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC;
|
||||
}
|
||||
}
|
||||
|
||||
for child in lastself.traverse_preorder() {
|
||||
if &child == other {
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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,
|
||||
}
|
||||
|
@ -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(
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 27bd48201ba241704b65f808b703b688a53af18d
|
||||
Subproject commit fbbb7c93c09ba20e827bdb20506da2b6c9d901c4
|
|
@ -1 +1 @@
|
|||
Subproject commit cac56f2e41ee8c9473f5ef59963ff5ea5b3e93e5
|
||||
Subproject commit 1c583b83da60bf4bb1a002075282d6918441929c
|
|
@ -1 +1 @@
|
|||
Subproject commit c993ff32e12b37cc3c4559d2442aa497a8f1c312
|
||||
Subproject commit 520b19313f4a684caf3c519d685a93d83479ee65
|
|
@ -1 +1 @@
|
|||
Subproject commit 3b1f121175faccc05cd60387b06cbe2cd4355ec4
|
||||
Subproject commit 8c1cbd6817241e7f13a985a79a904f1cfac7899e
|
|
@ -1 +1 @@
|
|||
Subproject commit b03ed6b97ddc489690c58b057e508c41f2ed59bc
|
||||
Subproject commit eb5dd25933f521b0a1bfdd26da1f9e7fff27a26a
|
|
@ -1 +1 @@
|
|||
Subproject commit beb749916d07c16892cdc18f188bbc8fc2f22e76
|
||||
Subproject commit 71e97b1e9f5f93d0f4aa3ec4b6d271b55e1055f2
|
|
@ -1 +1 @@
|
|||
Subproject commit 91a8a1a967e55ba03e710f6eaa56cf91e702dff1
|
||||
Subproject commit c29c94e8e14a87e3184d0273e025308d5d0a316e
|
|
@ -1 +1 @@
|
|||
Subproject commit b52d5496184a99a329f4eee96b9d57b810acbb0c
|
||||
Subproject commit 3c4f326b0ddd7bf47966facb56c40d76bfb6cec3
|
|
@ -1 +1 @@
|
|||
Subproject commit 4c25d24081ceb22f36244843e5e506bfaa481d08
|
||||
Subproject commit b19f248d8ef71f2c762ec41d8ed6b67cd330926c
|
|
@ -1 +1 @@
|
|||
Subproject commit 0dc0704215de008081d96a2a82dd5cc2143d7b72
|
||||
Subproject commit c94949f8c567e17c1594931ec62c7857ed24b047
|
|
@ -1 +1 @@
|
|||
Subproject commit 626605f83c3451e8458de04c1c516d6fc7069690
|
||||
Subproject commit fb4c04ac4caf9406b117f31df04fe8567f56b663
|
|
@ -69,12 +69,12 @@ 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() {
|
||||
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue