[non_canonical_partial_ord_impl]: Fix emitting warnings which conflict with needless_return

This commit is contained in:
Luv-Ray 2024-04-24 10:54:08 +08:00
parent c642d0cab6
commit 107e44b76f
3 changed files with 71 additions and 11 deletions

View file

@ -142,3 +142,21 @@ impl PartialOrd for H {
Some(Ord::cmp(self, other))
}
}
// #12683, do not lint
#[derive(Eq, PartialEq)]
struct I(u32);
impl Ord for I {
fn cmp(&self, other: &Self) -> Ordering {
todo!();
}
}
impl PartialOrd for I {
#[allow(clippy::needless_return)]
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
return Some(self.cmp(other));
}
}

View file

@ -146,3 +146,21 @@ impl PartialOrd for H {
Some(Ord::cmp(self, other))
}
}
// #12683, do not lint
#[derive(Eq, PartialEq)]
struct I(u32);
impl Ord for I {
fn cmp(&self, other: &Self) -> Ordering {
todo!();
}
}
impl PartialOrd for I {
#[allow(clippy::needless_return)]
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
return Some(self.cmp(other));
}
}