refactor: cargo clippy

This commit is contained in:
Florian Olk 2024-11-16 18:54:30 +01:00
parent ed53dfce1f
commit 1cb8784577
3 changed files with 22 additions and 27 deletions

View file

@ -22,7 +22,7 @@ use crate::{ui::graph::GraphView, GtkMessage, PipewireMessage};
mod imp {
use glib::closure_local;
use log::debug;
use super::*;

View file

@ -18,7 +18,7 @@ mod libspa_ext;
mod state;
use std::{
any::Any, cell::RefCell, collections::HashMap, mem::MaybeUninit, rc::Rc, time::Duration,
cell::RefCell, collections::HashMap, mem::MaybeUninit, rc::Rc, time::Duration,
};
use adw::glib::{self, clone};
@ -38,8 +38,7 @@ use pipewire::{
param::{ParamInfoFlags, ParamType},
pod::Pod,
sys::{
spa_pod_frame, SPA_PARAM_Props, SPA_PROP_channelVolumes, SPA_PROP_monitorMute,
SPA_PROP_monitorVolumes, SPA_PROP_mute, SPA_PROP_volume, SPA_TYPE_OBJECT_Props,
SPA_PARAM_Props, SPA_PROP_channelVolumes, SPA_PROP_mute, SPA_PROP_volume, SPA_TYPE_OBJECT_Props,
},
utils::{dict::DictRef, result::SpaResult, SpaTypes},
},
@ -400,30 +399,27 @@ fn handle_node_params(
set_node_param_props(node, vec![], None, None);
}
match pod.type_() {
SpaTypes::Object => {
let mut volume = None;
let mut channel_volumes = vec![];
let mut mute = None;
for prop in pod.iter_props() {
if prop.key() == SPA_PROP_volume && prop.value().is_float() {
volume = Some(parse_volume_pod(prop.value()));
} else if prop.key() == SPA_PROP_channelVolumes && prop.value().is_array() {
channel_volumes = parse_channelvolume_pod(prop.value());
} else if prop.key() == SPA_PROP_mute && prop.value().is_bool() {
mute = Some(parse_mute_pod(prop.value()));
}
if pod.type_() == SpaTypes::Object {
let mut volume = None;
let mut channel_volumes = vec![];
let mut mute = None;
for prop in pod.iter_props() {
if prop.key() == SPA_PROP_volume && prop.value().is_float() {
volume = Some(parse_volume_pod(prop.value()));
} else if prop.key() == SPA_PROP_channelVolumes && prop.value().is_array() {
channel_volumes = parse_channelvolume_pod(prop.value());
} else if prop.key() == SPA_PROP_mute && prop.value().is_bool() {
mute = Some(parse_mute_pod(prop.value()));
}
sender
.send_blocking(PipewireMessage::NodePropsChanged {
id,
volume,
channel_volumes,
mute,
})
.expect("Failed to send message");
}
_ => {}
sender
.send_blocking(PipewireMessage::NodePropsChanged {
id,
volume,
channel_volumes,
mute,
})
.expect("Failed to send message");
}
}

View file

@ -28,7 +28,6 @@ mod imp {
use std::{
cell::{Cell, RefCell},
collections::HashSet,
process::Command,
sync::OnceLock,
};