diff --git a/src/wasapi/device.rs b/src/wasapi/device.rs index 2cac6aa..a70b591 100644 --- a/src/wasapi/device.rs +++ b/src/wasapi/device.rs @@ -409,7 +409,7 @@ impl Device { // Retrieve the `IAudioClient`. let lock = match self.ensure_future_audio_client() { Ok(lock) => lock, - Err(e) if e.raw_os_error() == Some(AUDCLNT_E_DEVICE_INVALIDATED) => { + Err(ref e) if e.raw_os_error() == Some(AUDCLNT_E_DEVICE_INVALIDATED) => { return Err(SupportedFormatsError::DeviceNotAvailable) } Err(e) => { @@ -748,11 +748,11 @@ impl Devices { // can fail if the parameter is null, which should never happen check_result_backend_specific((*collection).GetCount(&mut count))?; - Devices { + Ok(Devices { collection: collection, total_count: count, next_item: 0, - } + }) } } } diff --git a/src/wasapi/mod.rs b/src/wasapi/mod.rs index 7fe9de8..6fb462b 100644 --- a/src/wasapi/mod.rs +++ b/src/wasapi/mod.rs @@ -21,10 +21,10 @@ fn check_result(result: HRESULT) -> Result<(), IoError> { fn check_result_backend_specific(result: HRESULT) -> Result<(), BackendSpecificError> { match check_result(result) { - Ok(()) => Ok(()) + Ok(()) => Ok(()), Err(err) => { let description = format!("{}", err); - return BackendSpecificError { description } + return Err(BackendSpecificError { description }); } } }