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

od:use derived PartialEq and Eq

Removing custom PartialEq and Eq implementations helps avoid issues like:

    help: refactor your code, or use `std::ptr::fn_addr_eq` to suppress the lint
       |
    29 |             (IntWriter(a), IntWriter(b)) => std::ptr::fn_addr_eq(*a, *b),
       |                                             ++++++++++++++++++++++ ~~~ +

Observable on nightly 1.86
This commit is contained in:
Alexander Shirokov 2025-01-26 11:42:35 +01:00
parent dfd5885e37
commit ae7238bbdf
No known key found for this signature in database
GPG key ID: 6020E4D7AFA8ECE7

View file

@ -7,7 +7,7 @@
use std::fmt; use std::fmt;
#[allow(clippy::enum_variant_names)] #[allow(clippy::enum_variant_names)]
#[derive(Copy)] #[derive(Copy, PartialEq, Eq)]
pub enum FormatWriter { pub enum FormatWriter {
IntWriter(fn(u64) -> String), IntWriter(fn(u64) -> String),
FloatWriter(fn(f64) -> 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 { impl fmt::Debug for FormatWriter {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match *self { match *self {