From d8743b34ce5ec7c4901981366b313e12410d489c Mon Sep 17 00:00:00 2001 From: Sebastian Imlay Date: Sun, 29 Dec 2019 15:02:34 -0800 Subject: [PATCH] Fixed compiler warnings * Removed extra semi-colon * Added dyn where requested * Removed ::std:: in thead::sleep call. --- src/host/coreaudio/enumerate.rs | 4 ++-- src/host/coreaudio/mod.rs | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/host/coreaudio/enumerate.rs b/src/host/coreaudio/enumerate.rs index 96de9bc..8805ce5 100644 --- a/src/host/coreaudio/enumerate.rs +++ b/src/host/coreaudio/enumerate.rs @@ -100,7 +100,7 @@ pub fn default_input_device() -> Option { }; let audio_device_id: AudioDeviceID = 0; - let data_size = mem::size_of::();; + let data_size = mem::size_of::(); let status = unsafe { AudioObjectGetPropertyData( kAudioObjectSystemObject, @@ -129,7 +129,7 @@ pub fn default_output_device() -> Option { }; let audio_device_id: AudioDeviceID = 0; - let data_size = mem::size_of::();; + let data_size = mem::size_of::(); let status = unsafe { AudioObjectGetPropertyData( kAudioObjectSystemObject, diff --git a/src/host/coreaudio/mod.rs b/src/host/coreaudio/mod.rs index 1c4903b..d527a8f 100644 --- a/src/host/coreaudio/mod.rs +++ b/src/host/coreaudio/mod.rs @@ -439,7 +439,7 @@ enum UserCallback { // // It is essential for the safety of the program that this callback is removed before `run` // returns (not possible with the current CPAL API). - Active(&'static mut (FnMut(StreamId, StreamDataResult) + Send)), + Active(&'static mut (dyn FnMut(StreamId, StreamDataResult) + Send)), // A queue of events that have occurred but that have not yet been emitted to the user as we // don't yet have a callback to do so. Inactive, @@ -559,7 +559,7 @@ impl EventLoop { if let UserCallback::Active(_) = *guard { panic!("`EventLoop::run` was called when the event loop was already running"); } - let callback: &mut (FnMut(StreamId, StreamDataResult) + Send) = &mut callback; + let callback: &mut (dyn FnMut(StreamId, StreamDataResult) + Send) = &mut callback; *guard = UserCallback::Active(unsafe { mem::transmute(callback) }); } @@ -743,12 +743,12 @@ impl EventLoop { // This should not take longer than a few ms, but we timeout after 1 sec just in case. let timer = ::std::time::Instant::now(); while sample_rate != reported_rate { - if timer.elapsed() > ::std::time::Duration::from_secs(1) { + if timer.elapsed() > Duration::from_secs(1) { let description = "timeout waiting for sample rate update for device".into(); let err = BackendSpecificError { description }; return Err(err.into()); } - ::std::thread::sleep(::std::time::Duration::from_millis(5)); + thread::sleep(Duration::from_millis(5)); } // Remove the `rate_listener` callback.