Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clippy fix: complex match condition #1270

Merged
merged 1 commit into from
Mar 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions src/alsa_mixer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ impl Mixer for AlsaMixer {

fn volume(&self) -> u16 {
let selem_id = alsa::mixer::SelemId::new(&self.mixer, 0);
match alsa::mixer::Mixer::new(&self.device, false)
.ok()
let mixer = alsa::mixer::Mixer::new(&self.device, false).ok();
let vol = mixer
.as_ref()
.and_then(|mixer| mixer.find_selem(&selem_id))
.and_then(|elem| {
Expand All @@ -58,9 +58,10 @@ impl Mixer for AlsaMixer {
let volume_steps = max - min + 1;
((volume - min) * (0xFFFF / volume_steps)) as u16
})
}) {
});
match vol {
Some(vol) => vol,
_ => {
None => {
error!(
"Couldn't read volume from alsa device with name \"{}\".",
self.device
Expand Down
Loading