Skip to content

Commit 45a6ff1

Browse files
authored
Using map_err over inspect_err (#231)
This patch fixes clippy::manual-inspect error. See [1] for details. [1] https://rust-lang.github.io/rust-clippy/master/index.html#/manual_inspect
1 parent 8bce3b3 commit 45a6ff1

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed

src/backend/mod.rs

+6-12
Original file line numberDiff line numberDiff line change
@@ -1689,14 +1689,13 @@ fn get_fixed_latency(devid: AudioObjectID, devtype: DeviceType) -> u32 {
16891689
} else {
16901690
get_stream_latency(devstreams[0].stream)
16911691
}
1692-
}).map_err(|e| {
1692+
}).inspect_err(|e| {
16931693
cubeb_log!(
16941694
"Cannot get the stream, or the latency of the first stream on device {} in {:?} scope. Error: {}",
16951695
devid,
16961696
devtype,
16971697
e
16981698
);
1699-
e
17001699
}).unwrap_or(0); // default stream latency
17011700

17021701
device_latency + stream_latency
@@ -3620,12 +3619,11 @@ impl<'ctx> CoreStreamData<'ctx> {
36203619
StreamParams::from(p)
36213620
};
36223621

3623-
self.input_dev_desc = create_stream_description(&params).map_err(|e| {
3622+
self.input_dev_desc = create_stream_description(&params).inspect_err(|_| {
36243623
cubeb_log!(
36253624
"({:p}) Setting format description for input failed.",
36263625
self.stm_ptr
36273626
);
3628-
e
36293627
})?;
36303628

36313629
#[cfg(feature = "audio-dump")]
@@ -3826,12 +3824,11 @@ impl<'ctx> CoreStreamData<'ctx> {
38263824
StreamParams::from(p)
38273825
};
38283826

3829-
self.output_dev_desc = create_stream_description(&params).map_err(|e| {
3827+
self.output_dev_desc = create_stream_description(&params).inspect_err(|_| {
38303828
cubeb_log!(
38313829
"({:p}) Could not initialize the audio stream description.",
38323830
self.stm_ptr
38333831
);
3834-
e
38353832
})?;
38363833

38373834
#[cfg(feature = "audio-dump")]
@@ -3856,12 +3853,11 @@ impl<'ctx> CoreStreamData<'ctx> {
38563853

38573854
let device_layout = self
38583855
.get_output_channel_layout()
3859-
.map_err(|e| {
3856+
.inspect_err(|_| {
38603857
cubeb_log!(
38613858
"({:p}) Could not get any channel layout. Defaulting to no channels.",
38623859
self.stm_ptr
38633860
);
3864-
e
38653861
})
38663862
.unwrap_or_default();
38673863

@@ -4739,9 +4735,8 @@ impl<'ctx> AudioUnitStream<'ctx> {
47394735

47404736
self.core_stream_data
47414737
.setup(&mut self.context.shared_voice_processing_unit)
4742-
.map_err(|e| {
4738+
.inspect_err(|_| {
47434739
cubeb_log!("({:p}) Setup failed.", self.core_stream_data.stm_ptr);
4744-
e
47454740
})?;
47464741

47474742
if let Ok(volume) = vol_rv {
@@ -4750,12 +4745,11 @@ impl<'ctx> AudioUnitStream<'ctx> {
47504745

47514746
// If the stream was running, start it again.
47524747
if !self.stopped.load(Ordering::SeqCst) {
4753-
self.core_stream_data.start_audiounits().map_err(|e| {
4748+
self.core_stream_data.start_audiounits().inspect_err(|_| {
47544749
cubeb_log!(
47554750
"({:p}) Start audiounit failed.",
47564751
self.core_stream_data.stm_ptr
47574752
);
4758-
e
47594753
})?;
47604754
}
47614755

0 commit comments

Comments
 (0)