neosmart / prettysize-rs

Pretty-print file sizes and more
Other
42 stars 5 forks source link

feat: Derive more traits #9

Closed Antosser closed 10 months ago

Antosser commented 11 months ago

This PR adds more derives to the Size struct. The following code was also removed because it could simply be derived.


impl PartialEq<Size> for Size {
    fn eq(&self, other: &Size) -> bool {
        self.bytes() == other.bytes()
    }
}
impl PartialEq<&Size> for Size {
    fn eq(&self, other: &&Size) -> bool {
        self.bytes() == other.bytes()
    }
}
impl PartialOrd<Size> for Size {
    fn partial_cmp(&self, other: &Size) -> Option<core::cmp::Ordering> {
        self.bytes().partial_cmp(&other.bytes())
    }
}
impl PartialOrd<&Size> for Size {
    fn partial_cmp(&self, other: &&Size) -> Option<core::cmp::Ordering> {
        self.bytes().partial_cmp(&other.bytes())
    }
}
mqudsi commented 10 months ago

LGTM