Fixed compiler warnings

* Removed extra semi-colon
* Added dyn where requested
* Removed ::std:: in thead::sleep call.
This commit is contained in:
Sebastian Imlay 2019-12-29 15:02:34 -08:00
parent 8d08a9eb42
commit d8743b34ce
2 changed files with 6 additions and 6 deletions

View File

@ -100,7 +100,7 @@ pub fn default_input_device() -> Option<Device> {
}; };
let audio_device_id: AudioDeviceID = 0; let audio_device_id: AudioDeviceID = 0;
let data_size = mem::size_of::<AudioDeviceID>();; let data_size = mem::size_of::<AudioDeviceID>();
let status = unsafe { let status = unsafe {
AudioObjectGetPropertyData( AudioObjectGetPropertyData(
kAudioObjectSystemObject, kAudioObjectSystemObject,
@ -129,7 +129,7 @@ pub fn default_output_device() -> Option<Device> {
}; };
let audio_device_id: AudioDeviceID = 0; let audio_device_id: AudioDeviceID = 0;
let data_size = mem::size_of::<AudioDeviceID>();; let data_size = mem::size_of::<AudioDeviceID>();
let status = unsafe { let status = unsafe {
AudioObjectGetPropertyData( AudioObjectGetPropertyData(
kAudioObjectSystemObject, kAudioObjectSystemObject,

View File

@ -439,7 +439,7 @@ enum UserCallback {
// //
// It is essential for the safety of the program that this callback is removed before `run` // It is essential for the safety of the program that this callback is removed before `run`
// returns (not possible with the current CPAL API). // 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 // 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. // don't yet have a callback to do so.
Inactive, Inactive,
@ -559,7 +559,7 @@ impl EventLoop {
if let UserCallback::Active(_) = *guard { if let UserCallback::Active(_) = *guard {
panic!("`EventLoop::run` was called when the event loop was already running"); 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) }); *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. // This should not take longer than a few ms, but we timeout after 1 sec just in case.
let timer = ::std::time::Instant::now(); let timer = ::std::time::Instant::now();
while sample_rate != reported_rate { 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 description = "timeout waiting for sample rate update for device".into();
let err = BackendSpecificError { description }; let err = BackendSpecificError { description };
return Err(err.into()); return Err(err.into());
} }
::std::thread::sleep(::std::time::Duration::from_millis(5)); thread::sleep(Duration::from_millis(5));
} }
// Remove the `rate_listener` callback. // Remove the `rate_listener` callback.