logos
logos copied to clipboard
Range's `Ord` implementation
Hello !
Running clippy on the code, it triggered clippy::derive_ord_xor_partial_ord
in logos-derive/src/graph/range.rs
:
#[derive(PartialOrd)]
pub struct Range { // although from what I can tell Range is not actually exported, so maybe it isn't so bad.
pub start: u8,
pub end: u8
}
impl Ord for Range {
fn cmp(&self, other: &Self) -> Ordering {
self.start.cmp(&other.start)
}
}
Indeed Ord
's documentation explicitly states that Ord
and PartialOrd
must agree, which is not the case here...
Is this normal, maybe done for a particular optimization ?