Remove expect

Signed-off-by: fufesou <linlong1266@gmail.com>
This commit is contained in:
fufesou 2024-11-23 09:00:18 +08:00
parent 8add08e51b
commit dd8e6bfe16

View file

@ -171,9 +171,17 @@ impl Device {
fn default_input_config(&self) -> Result<SupportedStreamConfig, DefaultStreamConfigError> {
let config = Self::supported_input_configs(self)
.expect("failed to get supported input configs")
.map_err(|e| DefaultStreamConfigError::BackendSpecific {
err: BackendSpecificError {
description: format!("Failed to get supported input configs: {e}"),
},
})?
.next()
.expect("no supported input configs")
.ok_or(DefaultStreamConfigError::BackendSpecific {
err: BackendSpecificError {
description: "No supported input configs".to_string(),
},
})?
.with_max_sample_rate();
Ok(config)
}