1
0
Fork 0
mirror of https://github.com/sile/hls_m3u8.git synced 2024-05-05 18:18:58 +00:00

fix clippy error by implementing PartialOrd manually for UFloat and Float

This commit is contained in:
Lucas 2021-08-02 20:15:45 +02:00
parent 8ad21ec161
commit 153c6e3e33
2 changed files with 12 additions and 2 deletions

View file

@ -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<f32> for Float {
// be soundly implemented.
impl Eq for Float {}
impl PartialOrd for Float {
#[inline]
fn partial_cmp(&self, other: &Self) -> Option<Ordering> { Some(self.cmp(other)) }
}
impl Ord for Float {
#[inline]
fn cmp(&self, other: &Self) -> Ordering {

View file

@ -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<f32> for UFloat {
// be soundly implemented.
impl Eq for UFloat {}
impl PartialOrd for UFloat {
#[inline]
fn partial_cmp(&self, other: &Self) -> Option<Ordering> { Some(self.cmp(other)) }
}
impl Ord for UFloat {
#[inline]
fn cmp(&self, other: &Self) -> Ordering {