Fix or selectively silence warnings in src/components.

This commit is contained in:
Simon Sapin 2014-07-08 15:46:34 +01:00
parent 53d5d35e7c
commit b1c4a9156c
7 changed files with 34 additions and 29 deletions

View file

@ -33,7 +33,7 @@ use servo_msg::constellation_msg::{ConstellationChan, InitLoadUrlMsg};
#[cfg(not(test))]
use servo_net::image_cache_task::ImageCacheTask;
#[cfg(not(test))]
use servo_net::resource_task::ResourceTask;
use servo_net::resource_task::new_resource_task;
#[cfg(not(test))]
use servo_util::time::TimeProfiler;
#[cfg(not(test))]
@ -106,7 +106,7 @@ pub fn run(opts: opts::Opts) {
pool.spawn(TaskOpts::new(), proc() {
let opts = &opts_clone;
// Create a Servo instance.
let resource_task = ResourceTask();
let resource_task = new_resource_task();
// If we are emitting an output file, then we need to block on
// image load or we risk emitting an output file missing the
// image.

View file

@ -10,14 +10,6 @@ use png;
// reference count them.
pub type Image = png::Image;
pub fn Image(width: u32, height: u32, color_type: png::ColorType, data: Vec<u8>) -> Image {
png::Image {
width: width,
height: height,
color_type: color_type,
pixels: data,
}
}
static TEST_IMAGE: &'static [u8] = include_bin!("test.jpeg");
@ -62,7 +54,12 @@ pub fn load_from_memory(buffer: &[u8]) -> Option<Image> {
stb_image::ImageU8(mut image) => {
assert!(image.depth == 4);
byte_swap(png::RGBA8, image.data.as_mut_slice());
Some(Image(image.width as u32, image.height as u32, png::RGBA8, image.data))
Some(png::Image {
width: image.width as u32,
height: image.height as u32,
color_type: png::RGBA8,
pixels: image.data
})
}
stb_image::ImageF32(_image) => fail!("HDR images not implemented"),
stb_image::Error(_) => None

View file

@ -165,7 +165,7 @@ each URL scheme
type LoaderTaskFactory = extern "Rust" fn() -> LoaderTask;
/// Create a ResourceTask with the default loaders
pub fn ResourceTask() -> ResourceTask {
pub fn new_resource_task() -> ResourceTask {
let loaders = vec!(
("file".to_string(), file_loader::factory),
("http".to_string(), http_loader::factory),
@ -180,7 +180,7 @@ fn create_resource_task_with_loaders(loaders: Vec<(String, LoaderTaskFactory)>)
builder.spawn(proc() {
let (chan, port) = channel();
setup_chan.send(chan);
ResourceManager(port, loaders).start();
ResourceManager::new(port, loaders).start();
});
setup_port.recv()
}
@ -192,11 +192,13 @@ struct ResourceManager {
}
fn ResourceManager(from_client: Receiver<ControlMsg>,
loaders: Vec<(String, LoaderTaskFactory)>) -> ResourceManager {
ResourceManager {
from_client : from_client,
loaders : loaders,
impl ResourceManager {
fn new(from_client: Receiver<ControlMsg>, loaders: Vec<(String, LoaderTaskFactory)>)
-> ResourceManager {
ResourceManager {
from_client : from_client,
loaders : loaders,
}
}
}
@ -244,13 +246,13 @@ impl ResourceManager {
#[test]
fn test_exit() {
let resource_task = ResourceTask();
let resource_task = new_resource_task();
resource_task.send(Exit);
}
#[test]
fn test_bad_scheme() {
let resource_task = ResourceTask();
let resource_task = new_resource_task();
let (start_chan, start) = channel();
resource_task.send(Load(LoadData::new(FromStr::from_str("bogus://whatever").unwrap()), start_chan));
let response = start.recv();

View file

@ -187,12 +187,14 @@ pub mod computed {
// TODO, as needed: root font size, viewport size, etc.
}
#[allow(non_snake_case_functions)]
#[inline]
pub fn compute_Au(value: specified::Length, context: &Context) -> Au {
compute_Au_with_font_size(value, context.font_size)
}
/// A special version of `compute_Au` used for `font-size`.
#[allow(non_snake_case_functions)]
#[inline]
pub fn compute_Au_with_font_size(value: specified::Length, reference_font_size: Au) -> Au {
match value {
@ -210,6 +212,7 @@ pub mod computed {
LP_Length(Au),
LP_Percentage(CSSFloat),
}
#[allow(non_snake_case_functions)]
pub fn compute_LengthOrPercentage(value: specified::LengthOrPercentage, context: &Context)
-> LengthOrPercentage {
match value {
@ -224,6 +227,7 @@ pub mod computed {
LPA_Percentage(CSSFloat),
LPA_Auto,
}
#[allow(non_snake_case_functions)]
pub fn compute_LengthOrPercentageOrAuto(value: specified::LengthOrPercentageOrAuto,
context: &Context) -> LengthOrPercentageOrAuto {
match value {
@ -239,6 +243,7 @@ pub mod computed {
LPN_Percentage(CSSFloat),
LPN_None,
}
#[allow(non_snake_case_functions)]
pub fn compute_LengthOrPercentageOrNone(value: specified::LengthOrPercentageOrNone,
context: &Context) -> LengthOrPercentageOrNone {
match value {

View file

@ -1365,14 +1365,17 @@ mod property_bit_field {
self.storage[bit / uint::BITS] &= !(1 << (bit % uint::BITS))
}
% for i, property in enumerate(LONGHANDS):
#[allow(non_snake_case_functions)]
#[inline]
pub fn get_${property.ident}(&self) -> bool {
self.get(${i})
}
#[allow(non_snake_case_functions)]
#[inline]
pub fn set_${property.ident}(&mut self) {
self.set(${i})
}
#[allow(non_snake_case_functions)]
#[inline]
pub fn clear_${property.ident}(&mut self) {
self.clear(${i})

View file

@ -8,6 +8,7 @@
use i = std::mem::init;
use std::cmp;
use std::intrinsics;
use std::kinds::marker::ContravariantLifetime;
use std::mem;
use std::ptr;
use std::raw::Slice;
@ -85,7 +86,7 @@ pub trait SmallVec<T> : SmallVecPrivate<T> {
SmallVecIterator {
ptr: self.begin(),
end: self.end(),
lifetime: None,
lifetime: ContravariantLifetime::<'a>,
}
}
@ -94,7 +95,7 @@ pub trait SmallVec<T> : SmallVecPrivate<T> {
SmallVecMutIterator {
ptr: mem::transmute(self.begin()),
end: mem::transmute(self.end()),
lifetime: None,
lifetime: ContravariantLifetime::<'a>,
}
}
}
@ -116,7 +117,7 @@ pub trait SmallVec<T> : SmallVecPrivate<T> {
allocation: ptr_opt,
cap: inline_size,
iter: iter,
lifetime: None,
lifetime: ContravariantLifetime::<'a>,
}
}
}
@ -247,7 +248,7 @@ pub trait SmallVec<T> : SmallVecPrivate<T> {
pub struct SmallVecIterator<'a,T> {
ptr: *T,
end: *T,
lifetime: Option<&'a T>
lifetime: ContravariantLifetime<'a>
}
impl<'a,T> Iterator<&'a T> for SmallVecIterator<'a,T> {
@ -271,7 +272,7 @@ impl<'a,T> Iterator<&'a T> for SmallVecIterator<'a,T> {
pub struct SmallVecMutIterator<'a,T> {
ptr: *mut T,
end: *mut T,
lifetime: Option<&'a mut T>
lifetime: ContravariantLifetime<'a>,
}
impl<'a,T> Iterator<&'a mut T> for SmallVecMutIterator<'a,T> {
@ -296,7 +297,7 @@ pub struct SmallVecMoveIterator<'a,T> {
allocation: Option<*mut u8>,
cap: uint,
iter: SmallVecIterator<'static,T>,
lifetime: Option<&'a T>,
lifetime: ContravariantLifetime<'a>,
}
impl<'a,T> Iterator<T> for SmallVecMoveIterator<'a,T> {

View file

@ -48,8 +48,6 @@ enum SupervisorMsg<QueueData, WorkData> {
struct WorkerInfo<QueueData, WorkData> {
/// The communication channel to the workers.
chan: Sender<WorkerMsg<QueueData, WorkData>>,
/// The buffer pool for this deque.
pool: BufferPool<WorkUnit<QueueData, WorkData>>,
/// The worker end of the deque, if we have it.
deque: Option<Worker<WorkUnit<QueueData, WorkData>>>,
/// The thief end of the work-stealing deque.
@ -208,7 +206,6 @@ impl<QueueData: Send, WorkData: Send> WorkQueue<QueueData, WorkData> {
let (worker, thief) = pool.deque();
infos.push(WorkerInfo {
chan: worker_chan,
pool: pool,
deque: Some(worker),
thief: thief,
});