chore(audio-watch): drop deprecated DeviceTrait::name fallback

rodio deprecated `DeviceTrait::name()` in favour of `description()`
(name) / `id()` (stable identifier). The legacy fallback in
`preferred_name()` was unreachable on our target platforms anyway —
the only path that matters is the `description()` one, since that is
what `get_audio_devices()` persists in settings.

Skip the device if `description()` fails instead of falling back to
the deprecated API. Silences the build warning.

cc
This commit is contained in:
vicrodh committed 2026-04-14 22:59:22 -06:00
1 parent 8871262377
commit c63c3ab160
1 file changed
+3 -5
+3 -5
View File
@@ -82,12 +82,10 @@ pub fn check_selected_device_presence(settings: &AudioSettingsState) -> DevicePr
// DeviceTrait::description() (richer, stable identifier). The
// legacy DeviceTrait::name() returns a different string on some
// platforms (especially PipeWire-backed Linux) and would cause
// every configured device to look 'missing' here.
// every configured device to look 'missing' here, so we skip
// devices whose description() fails rather than falling back.
fn preferred_name(d: &rodio::cpal::Device) -> Option<String> {
if let Ok(desc) = d.description() {
return Some(desc.name().to_string());
}
d.name().ok()
d.description().ok().map(|desc| desc.name().to_string())
}
let mut available: Vec<String> = Vec::new();