Skip to content
Permalink
Browse files

Fix some new warnings

  • Loading branch information...
SimonSapin committed Jun 19, 2019
1 parent 112f1dd commit 1d38bc041967b88838ed7b006aab9908e2f24474
Showing with 179 additions and 175 deletions.
  1. +5 −5 components/background_hang_monitor/background_hang_monitor.rs
  2. +1 −1 components/background_hang_monitor/sampler.rs
  3. +1 −1 components/background_hang_monitor/sampler_linux.rs
  4. +1 −1 components/background_hang_monitor/sampler_mac.rs
  5. +1 −1 components/background_hang_monitor/sampler_windows.rs
  6. +10 −10 components/canvas/azure_backend.rs
  7. +19 −19 components/canvas/canvas_data.rs
  8. +9 −9 components/canvas/raqote_backend.rs
  9. +1 −1 components/compositing/compositor_thread.rs
  10. +1 −1 components/compositing/windowing.rs
  11. +2 −2 components/config/pref_util.rs
  12. +1 −1 components/constellation/constellation.rs
  13. +5 −3 components/constellation/pipeline.rs
  14. +2 −2 components/embedder_traits/lib.rs
  15. +4 −3 components/embedder_traits/resources.rs
  16. +2 −2 components/gfx/text/util.rs
  17. +3 −3 components/layout_thread/lib.rs
  18. +1 −1 components/layout_traits/lib.rs
  19. +1 −1 components/malloc_size_of/lib.rs
  20. +4 −4 components/msg/constellation_msg.rs
  21. +1 −1 components/net/decoder.rs
  22. +1 −1 components/net/http_loader.rs
  23. +1 −1 components/script/dom/bindings/str.rs
  24. +17 −17 components/script/dom/bindings/xmlname.rs
  25. +2 −2 components/script/dom/dedicatedworkerglobalscope.rs
  26. +2 −2 components/script/dom/headers.rs
  27. +1 −1 components/script/dom/htmlareaelement.rs
  28. +1 −1 components/script/dom/htmlcollection.rs
  29. +1 −1 components/script/dom/htmlimageelement.rs
  30. +2 −2 components/script/dom/htmlmediaelement.rs
  31. +1 −1 components/script/dom/htmlscriptelement.rs
  32. +1 −1 components/script/dom/paintworkletglobalscope.rs
  33. +2 −2 components/script/dom/promisenativehandler.rs
  34. +1 −1 components/script/dom/rtcpeerconnection.rs
  35. +2 −2 components/script/dom/window.rs
  36. +1 −1 components/script/dom/xmlhttprequest.rs
  37. +0 −1 components/script/lib.rs
  38. +5 −5 components/script/script_thread.rs
  39. +1 −1 components/script_layout_interface/message.rs
  40. +3 −3 components/script_plugins/webidl_must_inherit.rs
  41. +1 −1 components/script_traits/lib.rs
  42. +1 −1 components/selectors/context.rs
  43. +1 −1 components/servo/lib.rs
  44. +2 −2 components/style/animation.rs
  45. +5 −5 components/style/attr.rs
  46. +2 −2 components/style/context.rs
  47. +4 −4 components/style/encoding_support.rs
  48. +1 −1 components/style/matching.rs
  49. +3 −3 components/style/parser.rs
  50. +3 −3 components/style/properties/cascade.rs
  51. +2 −2 components/style/properties/declaration_block.rs
  52. +2 −2 components/style/str.rs
  53. +1 −1 components/style/stylesheets/mod.rs
  54. +2 −2 components/style/stylesheets/rule_list.rs
  55. +1 −1 components/style/stylesheets/rule_parser.rs
  56. +8 −8 components/style/stylesheets/stylesheet.rs
  57. +7 −7 components/style/stylist.rs
  58. +1 −1 components/style/values/computed/mod.rs
  59. +1 −1 components/style_traits/specified_value_info.rs
  60. +3 −3 ports/glutin/app.rs
  61. +2 −2 ports/glutin/embedder.rs
  62. +1 −1 ports/libmlservo/src/lib.rs
  63. +2 −0 ports/libsimpleservo/api/src/gl_glue.rs
  64. +2 −2 ports/libsimpleservo/api/src/lib.rs
  65. +1 −1 ports/libsimpleservo/jniapi/src/lib.rs
@@ -26,7 +26,7 @@ impl HangMonitorRegister {
pub fn init(
constellation_chan: IpcSender<HangMonitorAlert>,
control_port: IpcReceiver<SamplerControlMsg>,
) -> Box<BackgroundHangMonitorRegister> {
) -> Box<dyn BackgroundHangMonitorRegister> {
let (sender, port) = unbounded();
let _ = thread::Builder::new().spawn(move || {
let mut monitor =
@@ -48,7 +48,7 @@ impl BackgroundHangMonitorRegister for HangMonitorRegister {
component_id: MonitoredComponentId,
transient_hang_timeout: Duration,
permanent_hang_timeout: Duration,
) -> Box<BackgroundHangMonitor> {
) -> Box<dyn BackgroundHangMonitor> {
let bhm_chan = BackgroundHangMonitorChan::new(self.sender.clone(), component_id);

#[cfg(all(
@@ -77,15 +77,15 @@ impl BackgroundHangMonitorRegister for HangMonitorRegister {
}

impl BackgroundHangMonitorClone for HangMonitorRegister {
fn clone_box(&self) -> Box<BackgroundHangMonitorRegister> {
fn clone_box(&self) -> Box<dyn BackgroundHangMonitorRegister> {
Box::new(self.clone())
}
}

/// Messages sent from monitored components to the monitor.
pub enum MonitoredComponentMsg {
/// Register component for monitoring,
Register(Box<Sampler>, Option<String>, Duration, Duration),
Register(Box<dyn Sampler>, Option<String>, Duration, Duration),
/// Unregister component for monitoring.
Unregister,
/// Notify start of new activity for a given component,
@@ -142,7 +142,7 @@ impl BackgroundHangMonitor for BackgroundHangMonitorChan {
}

struct MonitoredComponent {
sampler: Box<Sampler>,
sampler: Box<dyn Sampler>,
last_activity: Instant,
last_annotation: Option<HangAnnotation>,
transient_hang_timeout: Duration,
@@ -17,7 +17,7 @@ pub struct DummySampler;

impl DummySampler {
#[allow(dead_code)]
pub fn new() -> Box<Sampler> {
pub fn new() -> Box<dyn Sampler> {
Box::new(DummySampler)
}
}
@@ -128,7 +128,7 @@ pub struct LinuxSampler {

impl LinuxSampler {
#[allow(unsafe_code, dead_code)]
pub fn new() -> Box<Sampler> {
pub fn new() -> Box<dyn Sampler> {
let thread_id = unsafe { libc::syscall(libc::SYS_gettid) as libc::pid_t };
let handler = SigHandler::SigAction(sigprof_handler);
let action = SigAction::new(
@@ -16,7 +16,7 @@ pub struct MacOsSampler {

impl MacOsSampler {
#[allow(unsafe_code)]
pub fn new() -> Box<Sampler> {
pub fn new() -> Box<dyn Sampler> {
let thread_id = unsafe { mach::mach_init::mach_thread_self() };
Box::new(MacOsSampler { thread_id })
}
@@ -13,7 +13,7 @@ pub struct WindowsSampler {

impl WindowsSampler {
#[allow(unsafe_code, dead_code)]
pub fn new() -> Box<Sampler> {
pub fn new() -> Box<dyn Sampler> {
let thread_id = 0; // TODO: use winapi::um::processthreadsapi::GetThreadId
Box::new(WindowsSampler { thread_id })
}
@@ -55,7 +55,7 @@ impl Backend for AzureBackend {
&mut self,
style: FillOrStrokeStyle,
state: &mut CanvasPaintState<'a>,
drawtarget: &GenericDrawTarget,
drawtarget: &dyn GenericDrawTarget,
) {
if let Some(pattern) = style.to_azure_pattern(drawtarget) {
state.fill_style = Pattern::Azure(pattern)
@@ -66,7 +66,7 @@ impl Backend for AzureBackend {
&mut self,
style: FillOrStrokeStyle,
state: &mut CanvasPaintState<'a>,
drawtarget: &GenericDrawTarget,
drawtarget: &dyn GenericDrawTarget,
) {
if let Some(pattern) = style.to_azure_pattern(drawtarget) {
state.stroke_style = Pattern::Azure(pattern)
@@ -84,7 +84,7 @@ impl Backend for AzureBackend {
.set_composition_op(op.to_azure_style());
}

fn create_drawtarget(&self, size: Size2D<u64>) -> Box<GenericDrawTarget> {
fn create_drawtarget(&self, size: Size2D<u64>) -> Box<dyn GenericDrawTarget> {
// FIXME(nox): Why is the size made of i32 values?
Box::new(DrawTarget::new(
BackendType::Skia,
@@ -222,15 +222,15 @@ impl GenericDrawTarget for azure_hl::DrawTarget {
GradientStops::Azure(self.create_gradient_stops(&gradient_stops, extend_mode.into_azure()))
}

fn create_path_builder(&self) -> Box<GenericPathBuilder> {
fn create_path_builder(&self) -> Box<dyn GenericPathBuilder> {
Box::new(self.create_path_builder())
}

fn create_similar_draw_target(
&self,
size: &Size2D<i32>,
format: SurfaceFormat,
) -> Box<GenericDrawTarget> {
) -> Box<dyn GenericDrawTarget> {
Box::new(self.create_similar_draw_target(size, format.into_azure()))
}
fn create_source_surface_from_data(
@@ -378,7 +378,7 @@ impl GenericDrawTarget for azure_hl::DrawTarget {
}

#[allow(unsafe_code)]
fn snapshot_data(&self, f: &Fn(&[u8]) -> Vec<u8>) -> Vec<u8> {
fn snapshot_data(&self, f: &dyn Fn(&[u8]) -> Vec<u8>) -> Vec<u8> {
unsafe { f(self.snapshot().get_data_surface().data()) }
}

@@ -619,11 +619,11 @@ impl ToAzureStyle for CompositionOrBlending {
}

pub trait ToAzurePattern {
fn to_azure_pattern(&self, drawtarget: &GenericDrawTarget) -> Option<azure_hl::Pattern>;
fn to_azure_pattern(&self, drawtarget: &dyn GenericDrawTarget) -> Option<azure_hl::Pattern>;
}

impl ToAzurePattern for FillOrStrokeStyle {
fn to_azure_pattern(&self, drawtarget: &GenericDrawTarget) -> Option<azure_hl::Pattern> {
fn to_azure_pattern(&self, drawtarget: &dyn GenericDrawTarget) -> Option<azure_hl::Pattern> {
Some(match *self {
FillOrStrokeStyle::Color(ref color) => {
azure_hl::Pattern::Color(ColorPattern::new(color.to_azure_style()))
@@ -747,15 +747,15 @@ impl Path {
pub fn transformed_copy_to_builder(
&self,
transform: &Transform2D<f32>,
) -> Box<GenericPathBuilder> {
) -> Box<dyn GenericPathBuilder> {
Box::new(self.as_azure().transformed_copy_to_builder(transform))
}

pub fn contains_point(&self, x: f64, y: f64, path_transform: &Transform2D<f32>) -> bool {
self.as_azure().contains_point(x, y, path_transform)
}

pub fn copy_to_builder(&self) -> Box<GenericPathBuilder> {
pub fn copy_to_builder(&self) -> Box<dyn GenericPathBuilder> {
Box::new(self.as_azure().copy_to_builder())
}
}
@@ -26,9 +26,9 @@ enum PathState {
/// Path builder in user-space. If a transform has been applied
/// but no further path operations have occurred, it is stored
/// in the optional field.
UserSpacePathBuilder(Box<GenericPathBuilder>, Option<Transform2D<f32>>),
UserSpacePathBuilder(Box<dyn GenericPathBuilder>, Option<Transform2D<f32>>),
/// Path builder in device-space.
DeviceSpacePathBuilder(Box<GenericPathBuilder>),
DeviceSpacePathBuilder(Box<dyn GenericPathBuilder>),
/// Path in user-space. If a transform has been applied but
/// but no further path operations have occurred, it is stored
/// in the optional field.
@@ -61,20 +61,20 @@ pub trait Backend {
&mut self,
style: FillOrStrokeStyle,
state: &mut CanvasPaintState<'a>,
drawtarget: &GenericDrawTarget,
drawtarget: &dyn GenericDrawTarget,
);
fn set_stroke_style<'a>(
&mut self,
style: FillOrStrokeStyle,
state: &mut CanvasPaintState<'a>,
drawtarget: &GenericDrawTarget,
drawtarget: &dyn GenericDrawTarget,
);
fn set_global_composition<'a>(
&mut self,
op: CompositionOrBlending,
state: &mut CanvasPaintState<'a>,
);
fn create_drawtarget(&self, size: Size2D<u64>) -> Box<GenericDrawTarget>;
fn create_drawtarget(&self, size: Size2D<u64>) -> Box<dyn GenericDrawTarget>;
fn recreate_paint_state<'a>(&self, state: &CanvasPaintState<'a>) -> CanvasPaintState<'a>;
fn size_from_pattern(&self, rect: &Rect<f32>, pattern: &Pattern) -> Option<Size2D<f32>>;
}
@@ -117,7 +117,7 @@ pub trait GenericPathBuilder {
/// A wrapper around a stored PathBuilder and an optional transformation that should be
/// applied to any points to ensure they are in the matching device space.
struct PathBuilderRef<'a> {
builder: &'a Box<GenericPathBuilder>,
builder: &'a Box<dyn GenericPathBuilder>,
transform: Transform2D<f32>,
}

@@ -215,12 +215,12 @@ pub trait GenericDrawTarget {
gradient_stops: Vec<GradientStop>,
extend_mode: ExtendMode,
) -> GradientStops;
fn create_path_builder(&self) -> Box<GenericPathBuilder>;
fn create_path_builder(&self) -> Box<dyn GenericPathBuilder>;
fn create_similar_draw_target(
&self,
size: &Size2D<i32>,
format: SurfaceFormat,
) -> Box<GenericDrawTarget>;
) -> Box<dyn GenericDrawTarget>;
fn create_source_surface_from_data(
&self,
data: &[u8],
@@ -275,7 +275,7 @@ pub trait GenericDrawTarget {
stroke_options: &StrokeOptions,
draw_options: &DrawOptions,
);
fn snapshot_data(&self, f: &Fn(&[u8]) -> Vec<u8>) -> Vec<u8>;
fn snapshot_data(&self, f: &dyn Fn(&[u8]) -> Vec<u8>) -> Vec<u8>;
fn snapshot_data_owned(&self) -> Vec<u8>;
}

@@ -377,8 +377,8 @@ pub enum Filter {
}

pub struct CanvasData<'a> {
backend: Box<Backend>,
drawtarget: Box<GenericDrawTarget>,
backend: Box<dyn Backend>,
drawtarget: Box<dyn GenericDrawTarget>,
path_state: Option<PathState>,
state: CanvasPaintState<'a>,
saved_states: Vec<CanvasPaintState<'a>>,
@@ -392,12 +392,12 @@ pub struct CanvasData<'a> {
}

#[cfg(feature = "azure_backend")]
fn create_backend() -> Box<Backend> {
fn create_backend() -> Box<dyn Backend> {
Box::new(crate::azure_backend::AzureBackend)
}

#[cfg(feature = "raqote_backend")]
fn create_backend() -> Box<Backend> {
fn create_backend() -> Box<dyn Backend> {
Box::new(crate::raqote_backend::RaqoteBackend)
}

@@ -442,7 +442,7 @@ impl<'a> CanvasData<'a> {
image_data.into()
};

let writer = |draw_target: &GenericDrawTarget| {
let writer = |draw_target: &dyn GenericDrawTarget| {
write_image(
draw_target,
image_data,
@@ -498,7 +498,7 @@ impl<'a> CanvasData<'a> {
);

if self.need_to_draw_shadow() {
self.draw_with_shadow(&draw_rect, |new_draw_target: &GenericDrawTarget| {
self.draw_with_shadow(&draw_rect, |new_draw_target: &dyn GenericDrawTarget| {
new_draw_target.fill_rect(
&draw_rect,
self.state.fill_style.clone(),
@@ -524,7 +524,7 @@ impl<'a> CanvasData<'a> {
}

if self.need_to_draw_shadow() {
self.draw_with_shadow(&rect, |new_draw_target: &GenericDrawTarget| {
self.draw_with_shadow(&rect, |new_draw_target: &dyn GenericDrawTarget| {
new_draw_target.stroke_rect(
rect,
self.state.stroke_style.clone(),
@@ -1023,7 +1023,7 @@ impl<'a> CanvasData<'a> {
self.state.shadow_blur != 0.0f64)
}

fn create_draw_target_for_shadow(&self, source_rect: &Rect<f32>) -> Box<GenericDrawTarget> {
fn create_draw_target_for_shadow(&self, source_rect: &Rect<f32>) -> Box<dyn GenericDrawTarget> {
let draw_target = self.drawtarget.create_similar_draw_target(
&Size2D::new(
source_rect.size.width as i32,
@@ -1040,7 +1040,7 @@ impl<'a> CanvasData<'a> {

fn draw_with_shadow<F>(&self, rect: &Rect<f32>, draw_shadow_source: F)
where
F: FnOnce(&GenericDrawTarget),
F: FnOnce(&dyn GenericDrawTarget),
{
let shadow_src_rect = self.state.transform.transform_rect(rect);
let new_draw_target = self.create_draw_target_for_shadow(&shadow_src_rect);
@@ -1116,7 +1116,7 @@ pub struct CanvasPaintState<'a> {
/// dest_rect: Area of the destination target where the pixels will be copied
/// smoothing_enabled: It determines if smoothing is applied to the image result
fn write_image(
draw_target: &GenericDrawTarget,
draw_target: &dyn GenericDrawTarget,
image_data: Vec<u8>,
image_size: Size2D<f64>,
dest_rect: Rect<f64>,
@@ -36,7 +36,7 @@ impl Backend for RaqoteBackend {
&mut self,
_style: FillOrStrokeStyle,
_state: &mut CanvasPaintState<'a>,
_drawtarget: &GenericDrawTarget,
_drawtarget: &dyn GenericDrawTarget,
) {
unimplemented!()
}
@@ -45,7 +45,7 @@ impl Backend for RaqoteBackend {
&mut self,
_style: FillOrStrokeStyle,
_state: &mut CanvasPaintState<'a>,
_drawtarget: &GenericDrawTarget,
_drawtarget: &dyn GenericDrawTarget,
) {
unimplemented!()
}
@@ -58,7 +58,7 @@ impl Backend for RaqoteBackend {
unimplemented!()
}

fn create_drawtarget(&self, size: Size2D<u64>) -> Box<GenericDrawTarget> {
fn create_drawtarget(&self, size: Size2D<u64>) -> Box<dyn GenericDrawTarget> {
Box::new(raqote::DrawTarget::new(
size.width as i32,
size.height as i32,
@@ -121,15 +121,15 @@ impl Path {
pub fn transformed_copy_to_builder(
&self,
_transform: &Transform2D<f32>,
) -> Box<GenericPathBuilder> {
) -> Box<dyn GenericPathBuilder> {
unimplemented!()
}

pub fn contains_point(&self, _x: f64, _y: f64, _path_transform: &Transform2D<f32>) -> bool {
unimplemented!()
}

pub fn copy_to_builder(&self) -> Box<GenericPathBuilder> {
pub fn copy_to_builder(&self) -> Box<dyn GenericPathBuilder> {
unimplemented!()
}
}
@@ -156,15 +156,15 @@ impl GenericDrawTarget for raqote::DrawTarget {
unimplemented!()
}

fn create_path_builder(&self) -> Box<GenericPathBuilder> {
fn create_path_builder(&self) -> Box<dyn GenericPathBuilder> {
unimplemented!()
}

fn create_similar_draw_target(
&self,
_size: &Size2D<i32>,
_format: SurfaceFormat,
) -> Box<GenericDrawTarget> {
) -> Box<dyn GenericDrawTarget> {
unimplemented!()
}
fn create_source_surface_from_data(
@@ -246,13 +246,13 @@ impl GenericDrawTarget for raqote::DrawTarget {
&self,
_rect: &Rect<f32>,
_pattern: Pattern,
_stroke_options: &StrokeOptions,
_stroke_options: &StrokeOptions<'_>,
_draw_options: &DrawOptions,
) {
unimplemented!()
}

fn snapshot_data(&self, _f: &Fn(&[u8]) -> Vec<u8>) -> Vec<u8> {
fn snapshot_data(&self, _f: &dyn Fn(&[u8]) -> Vec<u8>) -> Vec<u8> {
unimplemented!()
}

0 comments on commit 1d38bc0

Please sign in to comment.
You can’t perform that action at this time.