mps-player clippy fix

This commit is contained in:
NGnius (Graham) 2022-01-29 16:19:15 -05:00
parent d908a0a033
commit 3c0d324d01

View file

@ -1,12 +1,12 @@
#[allow(unused_imports)] #[allow(unused_imports)]
use std::sync::mpsc::{channel, Receiver, Sender}; use std::sync::mpsc::{channel, Receiver, Sender};
#[cfg(all(target_os = "linux", feature = "os-controls"))] #[cfg(all(target_os = "linux", feature = "os-controls", feature = "mpris-player"))]
use std::thread::JoinHandle; use std::thread::JoinHandle;
#[cfg(all(target_os = "linux", feature = "os-controls"))] #[cfg(all(target_os = "linux", feature = "os-controls", feature = "mpris-player"))]
use mpris_player::{Metadata, MprisPlayer, PlaybackStatus}; use mpris_player::{Metadata, MprisPlayer, PlaybackStatus};
#[cfg(all(target_os = "linux", feature = "os-controls"))] #[cfg(all(target_os = "linux", feature = "os-controls", feature = "mpris-player"))]
use mps_interpreter::MpsItem; use mps_interpreter::MpsItem;
//use super::MpsController; //use super::MpsController;
@ -14,7 +14,7 @@ use super::player_wrapper::{ControlAction, PlaybackAction};
/// OS-specific APIs for media controls. /// OS-specific APIs for media controls.
/// Currently only Linux (dbus) is supported. /// Currently only Linux (dbus) is supported.
#[cfg(all(target_os = "linux", feature = "os-controls"))] #[cfg(all(target_os = "linux", feature = "os-controls", feature = "mpris-player"))]
pub struct SystemControlWrapper { pub struct SystemControlWrapper {
control: Sender<ControlAction>, control: Sender<ControlAction>,
dbus_handle: Option<JoinHandle<()>>, //std::sync::Arc<MprisPlayer>, dbus_handle: Option<JoinHandle<()>>, //std::sync::Arc<MprisPlayer>,
@ -25,20 +25,20 @@ pub struct SystemControlWrapper {
/// OS-specific APIs for media controls. /// OS-specific APIs for media controls.
/// Currently only Linux (dbus) is supported. /// Currently only Linux (dbus) is supported.
#[cfg(not(feature = "os-controls"))] #[cfg(any(not(feature = "os-controls"), not(all(target_os = "linux", feature = "os-controls", feature = "mpris-player"))))]
pub struct SystemControlWrapper { pub struct SystemControlWrapper {
#[allow(dead_code)] #[allow(dead_code)]
control: Sender<ControlAction>, control: Sender<ControlAction>,
playback_receiver: Option<Receiver<PlaybackAction>>, playback_receiver: Option<Receiver<PlaybackAction>>,
} }
#[cfg(all(target_os = "linux", feature = "os-controls"))] #[cfg(all(target_os = "linux", feature = "os-controls", feature = "mpris-player"))]
enum DbusControl { enum DbusControl {
Die, Die,
SetMetadata(Metadata), SetMetadata(Metadata),
} }
#[cfg(all(target_os = "linux", feature = "os-controls"))] #[cfg(all(target_os = "linux", feature = "os-controls", feature = "mpris-player"))]
impl SystemControlWrapper { impl SystemControlWrapper {
pub fn new(control: Sender<ControlAction>) -> Self { pub fn new(control: Sender<ControlAction>) -> Self {
Self { Self {
@ -221,7 +221,7 @@ impl SystemControlWrapper {
} }
} }
#[cfg(not(feature = "os-controls"))] #[cfg(any(not(feature = "os-controls"), not(all(target_os = "linux", feature = "os-controls", feature = "mpris-player"))))]
impl SystemControlWrapper { impl SystemControlWrapper {
pub fn new(control: Sender<ControlAction>) -> Self { pub fn new(control: Sender<ControlAction>) -> Self {
Self { Self {