From 778599cb37959dbaa928871e15ed6f31b188d771 Mon Sep 17 00:00:00 2001 From: h7x4 Date: Sat, 3 Aug 2024 16:35:15 +0200 Subject: [PATCH] cargo fmt + clippy --- src/event_parser.rs | 1 - src/property_parser.rs | 24 ++++++++++++------------ tests/integration_tests/misc.rs | 8 +++++--- tests/mock_socket_tests/get_property.rs | 5 +---- 4 files changed, 18 insertions(+), 20 deletions(-) diff --git a/src/event_parser.rs b/src/event_parser.rs index 5c9a142..62feacc 100644 --- a/src/event_parser.rs +++ b/src/event_parser.rs @@ -218,7 +218,6 @@ pub(crate) fn parse_event(raw_event: MpvIpcEvent) -> Result { // "get-property-reply" => // "set-property-reply" => // "command-reply" => - "client-message" => parse_client_message(event), "video-reconfig" => Ok(Event::VideoReconfig), "audio-reconfig" => Ok(Event::AudioReconfig), diff --git a/src/property_parser.rs b/src/property_parser.rs index 5b1586f..75a162d 100644 --- a/src/property_parser.rs +++ b/src/property_parser.rs @@ -276,17 +276,17 @@ pub fn parse_property(name: &str, data: Option) -> Result { - let eof_reached = match data { - Some(MpvDataType::Bool(b)) => b, - Some(data) => { - return Err(MpvError::DataContainsUnexpectedType { - expected_type: "bool".to_owned(), - received: data, - }) - } - None => true, - }; - Ok(Property::EofReached(eof_reached)) + let eof_reached = match data { + Some(MpvDataType::Bool(b)) => b, + Some(data) => { + return Err(MpvError::DataContainsUnexpectedType { + expected_type: "bool".to_owned(), + received: data, + }) + } + None => true, + }; + Ok(Property::EofReached(eof_reached)) } // TODO: add missing cases _ => Ok(Property::Unknown { @@ -327,7 +327,7 @@ fn mpv_data_to_playlist_entry( received: data.clone(), }) } - None => false + None => false, }; Ok(PlaylistEntry { id: 0, diff --git a/tests/integration_tests/misc.rs b/tests/integration_tests/misc.rs index 7c11044..1d51948 100644 --- a/tests/integration_tests/misc.rs +++ b/tests/integration_tests/misc.rs @@ -29,7 +29,6 @@ async fn test_set_property() -> Result<(), MpvError> { Ok(()) } - #[tokio::test] #[cfg(target_family = "unix")] async fn test_get_unavailable_property() -> Result<(), MpvError> { @@ -48,10 +47,13 @@ async fn test_get_unavailable_property() -> Result<(), MpvError> { async fn test_get_nonexistent_property() -> Result<(), MpvError> { let (mut proc, mpv) = spawn_headless_mpv().await.unwrap(); let nonexistent = mpv.get_property::("nonexistent").await; - assert_eq!(nonexistent, Err(MpvError::MpvError("property not found".to_string()))); + assert_eq!( + nonexistent, + Err(MpvError::MpvError("property not found".to_string())) + ); mpv.kill().await.unwrap(); proc.kill().await.unwrap(); Ok(()) -} \ No newline at end of file +} diff --git a/tests/mock_socket_tests/get_property.rs b/tests/mock_socket_tests/get_property.rs index 595d633..8639907 100644 --- a/tests/mock_socket_tests/get_property.rs +++ b/tests/mock_socket_tests/get_property.rs @@ -85,10 +85,7 @@ async fn test_get_unavailable_property() -> Result<(), MpvError> { let mpv = Mpv::connect_socket(server).await?; let maybe_volume = mpv.get_property::("volume").await; - assert_eq!( - maybe_volume, - Ok(None), - ); + assert_eq!(maybe_volume, Ok(None),); join_handle.await.unwrap().unwrap();