From 8ad21ec161cb7eedfd2a06ee663f3988f70ca38d Mon Sep 17 00:00:00 2001 From: Lucas <24826124+Luro02@users.noreply.github.com> Date: Mon, 2 Aug 2021 20:05:11 +0200 Subject: [PATCH 1/2] fix compiler errors --- src/media_playlist.rs | 2 +- src/types/in_stream_id.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/media_playlist.rs b/src/media_playlist.rs index 0ef8e7d..bf3ff39 100644 --- a/src/media_playlist.rs +++ b/src/media_playlist.rs @@ -727,7 +727,7 @@ impl FromStr for MediaPlaylist<'static> { type Err = Error; fn from_str(input: &str) -> Result { - Ok(parse_media_playlist(input, &mut Self::builder())?.into_owned()) + Ok(parse_media_playlist(input, &mut MediaPlaylist::builder())?.into_owned()) } } diff --git a/src/types/in_stream_id.rs b/src/types/in_stream_id.rs index ee35989..64f3efb 100644 --- a/src/types/in_stream_id.rs +++ b/src/types/in_stream_id.rs @@ -19,8 +19,8 @@ use crate::types::ProtocolVersion; /// [`MediaPlaylist`]: crate::MediaPlaylist #[non_exhaustive] #[allow(missing_docs)] -#[strum(serialize_all = "UPPERCASE")] #[derive(Ord, PartialOrd, Debug, Clone, Copy, PartialEq, Eq, Hash, Display, EnumString)] +#[strum(serialize_all = "UPPERCASE")] pub enum InStreamId { Cc1, Cc2, From 153c6e3e330ebe03f3844268bf28ecdb08cd1a56 Mon Sep 17 00:00:00 2001 From: Lucas <24826124+Luro02@users.noreply.github.com> Date: Mon, 2 Aug 2021 20:15:45 +0200 Subject: [PATCH 2/2] fix clippy error by implementing `PartialOrd` manually for `UFloat` and `Float` --- src/types/float.rs | 7 ++++++- src/types/ufloat.rs | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/types/float.rs b/src/types/float.rs index 25ed85a..57261e7 100644 --- a/src/types/float.rs +++ b/src/types/float.rs @@ -12,7 +12,7 @@ use crate::Error; /// [`NaN`]: core::f32::NAN /// [`INFINITY`]: core::f32::INFINITY /// [`NEG_INFINITY`]: core::f32::NEG_INFINITY -#[derive(AsRef, Deref, Default, Debug, Copy, Clone, Display, PartialOrd)] +#[derive(AsRef, Deref, Default, Debug, Copy, Clone, Display)] pub struct Float(f32); impl Float { @@ -129,6 +129,11 @@ impl PartialEq for Float { // be soundly implemented. impl Eq for Float {} +impl PartialOrd for Float { + #[inline] + fn partial_cmp(&self, other: &Self) -> Option { Some(self.cmp(other)) } +} + impl Ord for Float { #[inline] fn cmp(&self, other: &Self) -> Ordering { diff --git a/src/types/ufloat.rs b/src/types/ufloat.rs index 08f4a5e..d4a0d57 100644 --- a/src/types/ufloat.rs +++ b/src/types/ufloat.rs @@ -13,7 +13,7 @@ use crate::Error; /// [`NaN`]: core::f32::NAN /// [`INFINITY`]: core::f32::INFINITY /// [`NEG_INFINITY`]: core::f32::NEG_INFINITY -#[derive(AsRef, Deref, Default, Debug, Copy, Clone, PartialOrd, Display)] +#[derive(AsRef, Deref, Default, Debug, Copy, Clone, Display)] pub struct UFloat(f32); impl UFloat { @@ -141,6 +141,11 @@ impl PartialEq for UFloat { // be soundly implemented. impl Eq for UFloat {} +impl PartialOrd for UFloat { + #[inline] + fn partial_cmp(&self, other: &Self) -> Option { Some(self.cmp(other)) } +} + impl Ord for UFloat { #[inline] fn cmp(&self, other: &Self) -> Ordering {