1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-28 03:27:44 +00:00

Merge pull request #7211 from alexs-sh/od-use-derived-cmp

od:remove custom implementations of PartialEq and Eq
This commit is contained in:
Sylvestre Ledru 2025-01-26 13:48:00 +01:00 committed by GitHub
commit 2430e2a396
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -7,7 +7,7 @@
use std::fmt;
#[allow(clippy::enum_variant_names)]
#[derive(Copy)]
#[derive(Copy, PartialEq, Eq)]
pub enum FormatWriter {
IntWriter(fn(u64) -> String),
FloatWriter(fn(f64) -> String),
@ -21,21 +21,6 @@ impl Clone for FormatWriter {
}
}
impl PartialEq for FormatWriter {
fn eq(&self, other: &Self) -> bool {
use crate::formatteriteminfo::FormatWriter::*;
match (self, other) {
(IntWriter(a), IntWriter(b)) => a == b,
(FloatWriter(a), FloatWriter(b)) => a == b,
(MultibyteWriter(a), MultibyteWriter(b)) => *a as usize == *b as usize,
_ => false,
}
}
}
impl Eq for FormatWriter {}
impl fmt::Debug for FormatWriter {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match *self {