cargo fmt + clippy
This commit is contained in:
parent
99e4622ef7
commit
6a0a275f64
|
@ -218,7 +218,6 @@ pub(crate) fn parse_event(raw_event: MpvIpcEvent) -> Result<Event, MpvError> {
|
||||||
// "get-property-reply" =>
|
// "get-property-reply" =>
|
||||||
// "set-property-reply" =>
|
// "set-property-reply" =>
|
||||||
// "command-reply" =>
|
// "command-reply" =>
|
||||||
|
|
||||||
"client-message" => parse_client_message(event),
|
"client-message" => parse_client_message(event),
|
||||||
"video-reconfig" => Ok(Event::VideoReconfig),
|
"video-reconfig" => Ok(Event::VideoReconfig),
|
||||||
"audio-reconfig" => Ok(Event::AudioReconfig),
|
"audio-reconfig" => Ok(Event::AudioReconfig),
|
||||||
|
|
|
@ -276,17 +276,17 @@ pub fn parse_property(name: &str, data: Option<MpvDataType>) -> Result<Property,
|
||||||
Ok(Property::Mute(mute))
|
Ok(Property::Mute(mute))
|
||||||
}
|
}
|
||||||
"eof-reached" => {
|
"eof-reached" => {
|
||||||
let eof_reached = match data {
|
let eof_reached = match data {
|
||||||
Some(MpvDataType::Bool(b)) => b,
|
Some(MpvDataType::Bool(b)) => b,
|
||||||
Some(data) => {
|
Some(data) => {
|
||||||
return Err(MpvError::DataContainsUnexpectedType {
|
return Err(MpvError::DataContainsUnexpectedType {
|
||||||
expected_type: "bool".to_owned(),
|
expected_type: "bool".to_owned(),
|
||||||
received: data,
|
received: data,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
None => true,
|
None => true,
|
||||||
};
|
};
|
||||||
Ok(Property::EofReached(eof_reached))
|
Ok(Property::EofReached(eof_reached))
|
||||||
}
|
}
|
||||||
// TODO: add missing cases
|
// TODO: add missing cases
|
||||||
_ => Ok(Property::Unknown {
|
_ => Ok(Property::Unknown {
|
||||||
|
@ -327,7 +327,7 @@ fn mpv_data_to_playlist_entry(
|
||||||
received: data.clone(),
|
received: data.clone(),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
None => false
|
None => false,
|
||||||
};
|
};
|
||||||
Ok(PlaylistEntry {
|
Ok(PlaylistEntry {
|
||||||
id: 0,
|
id: 0,
|
||||||
|
|
|
@ -29,7 +29,6 @@ async fn test_set_property() -> Result<(), MpvError> {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
#[cfg(target_family = "unix")]
|
#[cfg(target_family = "unix")]
|
||||||
async fn test_get_unavailable_property() -> Result<(), MpvError> {
|
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> {
|
async fn test_get_nonexistent_property() -> Result<(), MpvError> {
|
||||||
let (mut proc, mpv) = spawn_headless_mpv().await.unwrap();
|
let (mut proc, mpv) = spawn_headless_mpv().await.unwrap();
|
||||||
let nonexistent = mpv.get_property::<f64>("nonexistent").await;
|
let nonexistent = mpv.get_property::<f64>("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();
|
mpv.kill().await.unwrap();
|
||||||
proc.kill().await.unwrap();
|
proc.kill().await.unwrap();
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
|
@ -85,10 +85,7 @@ async fn test_get_unavailable_property() -> Result<(), MpvError> {
|
||||||
let mpv = Mpv::connect_socket(server).await?;
|
let mpv = Mpv::connect_socket(server).await?;
|
||||||
let maybe_volume = mpv.get_property::<f64>("volume").await;
|
let maybe_volume = mpv.get_property::<f64>("volume").await;
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(maybe_volume, Ok(None),);
|
||||||
maybe_volume,
|
|
||||||
Ok(None),
|
|
||||||
);
|
|
||||||
|
|
||||||
join_handle.await.unwrap().unwrap();
|
join_handle.await.unwrap().unwrap();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue