Implement PartialEq manually to shut up clippy

This commit is contained in:
Fabian Boehm 2023-10-06 17:10:59 +02:00
parent 1073f59929
commit 6775b0b1ad

View File

@ -56,10 +56,7 @@ mod topic_monitor_ffi {
/// The list of topics which may be observed.
#[repr(u8)]
// clippy 1.72 complains that the PartialOrd should be "{ Some(self.cmp(other)) }"
// but that requires us to implement PartialOrd ourselves.
#[allow(clippy::incorrect_partial_ord_impl_on_ord_type)]
#[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord)]
#[derive(Copy, Clone, Debug, PartialEq, Eq, Ord)]
pub enum topic_t {
sighupint, // Corresponds to both SIGHUP and SIGINT signals.
sigchld, // Corresponds to SIGCHLD signal.
@ -78,6 +75,14 @@ mod topic_monitor_ffi {
}
}
// FIXME: #derive-ing this currently makes clippy complain
// about https://rust-lang.github.io/rust-clippy/master/index.html#/incorrect_partial_ord_impl_on_ord_type
impl PartialOrd for topic_t {
fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
Some(self.cmp(other))
}
}
pub use topic_monitor_ffi::{generation_list_t, topic_t};
pub type generation_t = u64;