diff options
author | Simon Sapin <simon.sapin@exyr.org> | 2014-07-08 15:46:34 +0100 |
---|---|---|
committer | Simon Sapin <simon.sapin@exyr.org> | 2014-07-08 15:46:34 +0100 |
commit | b1c4a9156cc6d89044495b3cc10e3a37e63bb3b5 (patch) | |
tree | a8449b4926de1209ed2436fc982cd6ed45583f80 /src | |
parent | 53d5d35e7cc55158179185010376b8a5ac79def2 (diff) | |
download | servo-b1c4a9156cc6d89044495b3cc10e3a37e63bb3b5.tar.gz servo-b1c4a9156cc6d89044495b3cc10e3a37e63bb3b5.zip |
Fix or selectively silence warnings in src/components.
Diffstat (limited to 'src')
-rw-r--r-- | src/components/main/servo.rs | 4 | ||||
-rw-r--r-- | src/components/net/image/base.rs | 15 | ||||
-rw-r--r-- | src/components/net/resource_task.rs | 20 | ||||
-rw-r--r-- | src/components/style/properties/common_types.rs | 5 | ||||
-rw-r--r-- | src/components/style/properties/mod.rs.mako | 3 | ||||
-rw-r--r-- | src/components/util/smallvec.rs | 13 | ||||
-rw-r--r-- | src/components/util/workqueue.rs | 3 |
7 files changed, 34 insertions, 29 deletions
diff --git a/src/components/main/servo.rs b/src/components/main/servo.rs index 929bfea6491..1bfbc31c3e0 100644 --- a/src/components/main/servo.rs +++ b/src/components/main/servo.rs @@ -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. diff --git a/src/components/net/image/base.rs b/src/components/net/image/base.rs index 67eaa0835b2..5e865976f48 100644 --- a/src/components/net/image/base.rs +++ b/src/components/net/image/base.rs @@ -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 diff --git a/src/components/net/resource_task.rs b/src/components/net/resource_task.rs index 4eb46ae20b3..2316c099151 100644 --- a/src/components/net/resource_task.rs +++ b/src/components/net/resource_task.rs @@ -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(); diff --git a/src/components/style/properties/common_types.rs b/src/components/style/properties/common_types.rs index 724778f9ab2..5dbffb81938 100644 --- a/src/components/style/properties/common_types.rs +++ b/src/components/style/properties/common_types.rs @@ -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 { diff --git a/src/components/style/properties/mod.rs.mako b/src/components/style/properties/mod.rs.mako index e531f4aac8f..3157ac8c5fd 100644 --- a/src/components/style/properties/mod.rs.mako +++ b/src/components/style/properties/mod.rs.mako @@ -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}) diff --git a/src/components/util/smallvec.rs b/src/components/util/smallvec.rs index 8a3c96aa903..0e81a9420f2 100644 --- a/src/components/util/smallvec.rs +++ b/src/components/util/smallvec.rs @@ -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> { diff --git a/src/components/util/workqueue.rs b/src/components/util/workqueue.rs index ccfbc03da1a..6c9d60ca989 100644 --- a/src/components/util/workqueue.rs +++ b/src/components/util/workqueue.rs @@ -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, }); |