Fixed an error found due to clippy

This commit is contained in:
Anne de Jong 2024-07-18 13:30:23 +02:00
parent ff6a0687c4
commit f3dbf9d948
2 changed files with 53 additions and 51 deletions

View File

@ -365,11 +365,11 @@ impl CpalApi {
for (och, ich) in out_chunks.into_iter().zip(siggen_chunks.into_iter()) { for (och, ich) in out_chunks.into_iter().zip(siggen_chunks.into_iter()) {
let mut sig_frame_iter = ich.into_iter(); let mut sig_frame_iter = ich.into_iter();
och.into_iter().zip(&enabled_outch).for_each(|(o, en)| { och.into_iter().zip(&enabled_outch).for_each(|(o, en)| {
(if *en { if *en {
*o = sig_frame_iter.next().unwrap(); *o = sig_frame_iter.next().unwrap();
} else { } else {
*o = Sample::EQUILIBRIUM; *o = Sample::EQUILIBRIUM;
}) }
}); });
} }
@ -487,6 +487,7 @@ impl CpalApi {
sender: Sender<InStreamMsg>, sender: Sender<InStreamMsg>,
) -> Result<Box<dyn Stream>> { ) -> Result<Box<dyn Stream>> {
for cpaldev in self.host.devices()? { for cpaldev in self.host.devices()? {
if cpaldev.name().unwrap_or("".to_string()) == conf.device_name {
// See if we can create a supported stream config. // See if we can create a supported stream config.
let supported_config = (match stype { let supported_config = (match stype {
StreamType::Duplex => bail!("Duplex stream not supported for CPAL"), StreamType::Duplex => bail!("Duplex stream not supported for CPAL"),
@ -538,6 +539,7 @@ impl CpalApi {
status, status,
})); }));
} }
}
bail!(format!( bail!(format!(
"Error: requested device {} not found. Please make sure the device is available.", "Error: requested device {} not found. Please make sure the device is available.",
devinfo.device_name devinfo.device_name

View File

@ -155,7 +155,7 @@ impl InStreamData {
let v: &'a [T] = unsafe { reinterpret_slice($c) }; let v: &'a [T] = unsafe { reinterpret_slice($c) };
v.iter().skip(ch).step_by(self.meta.nchannels()) v.iter().skip(ch).step_by(self.meta.nchannels())
}}; }};
}; }
match &self.raw { match &self.raw {
RawStreamData::Datai8(c) => { RawStreamData::Datai8(c) => {
@ -276,7 +276,7 @@ impl InStreamData {
) )
.expect(errmsg) .expect(errmsg)
}; };
}; }
// Perform the actual conversion // Perform the actual conversion
let converted_data = match &self.raw { let converted_data = match &self.raw {