Fix some new warnings

This commit is contained in:
Simon Sapin 2019-06-19 16:07:13 +02:00
parent 112f1ddeba
commit 1d38bc0419
65 changed files with 179 additions and 175 deletions

View file

@ -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,7 +77,7 @@ 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())
}
}
@ -85,7 +85,7 @@ impl BackgroundHangMonitorClone for HangMonitorRegister {
/// 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,

View file

@ -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)
}
}

View file

@ -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(

View file

@ -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 })
}

View file

@ -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 })
}