Skip to content

Commit 4489647

Browse files
committed
clippy fix: remove or annotate manual PartialEq::ne
1 parent f51c987 commit 4489647

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

library/core/src/cmp.rs

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1817,8 +1817,6 @@ mod impls {
18171817
impl const PartialEq for $t {
18181818
#[inline]
18191819
fn eq(&self, other: &Self) -> bool { *self == *other }
1820-
#[inline]
1821-
fn ne(&self, other: &Self) -> bool { *self != *other }
18221820
}
18231821
)*)
18241822
}
@@ -1829,10 +1827,6 @@ mod impls {
18291827
fn eq(&self, _other: &()) -> bool {
18301828
true
18311829
}
1832-
#[inline]
1833-
fn ne(&self, _other: &()) -> bool {
1834-
false
1835-
}
18361830
}
18371831

18381832
partial_eq_impl! {
@@ -2030,6 +2024,9 @@ mod impls {
20302024
fn eq(&self, other: &&B) -> bool {
20312025
PartialEq::eq(*self, *other)
20322026
}
2027+
// if <A as PartialEq<B>>::ne uses inline assembly or FFI, then
2028+
// this forwarding impl may be more efficient than the default impl
2029+
#[allow(clippy::partialeq_ne_impl)]
20332030
#[inline]
20342031
fn ne(&self, other: &&B) -> bool {
20352032
PartialEq::ne(*self, *other)
@@ -2102,6 +2099,9 @@ mod impls {
21022099
fn eq(&self, other: &&mut B) -> bool {
21032100
PartialEq::eq(*self, *other)
21042101
}
2102+
// if <A as PartialEq<B>>::ne uses inline assembly or FFI, then
2103+
// this forwarding impl may be more efficient than the default impl
2104+
#[allow(clippy::partialeq_ne_impl)]
21052105
#[inline]
21062106
fn ne(&self, other: &&mut B) -> bool {
21072107
PartialEq::ne(*self, *other)
@@ -2172,6 +2172,9 @@ mod impls {
21722172
fn eq(&self, other: &&mut B) -> bool {
21732173
PartialEq::eq(*self, *other)
21742174
}
2175+
// if <A as PartialEq<B>>::ne uses inline assembly or FFI, then
2176+
// this forwarding impl may be more efficient than the default impl
2177+
#[allow(clippy::partialeq_ne_impl)]
21752178
#[inline]
21762179
fn ne(&self, other: &&mut B) -> bool {
21772180
PartialEq::ne(*self, *other)
@@ -2188,6 +2191,9 @@ mod impls {
21882191
fn eq(&self, other: &&B) -> bool {
21892192
PartialEq::eq(*self, *other)
21902193
}
2194+
// if <A as PartialEq<B>>::ne uses inline assembly or FFI, then
2195+
// this forwarding impl may be more efficient than the default impl
2196+
#[allow(clippy::partialeq_ne_impl)]
21912197
#[inline]
21922198
fn ne(&self, other: &&B) -> bool {
21932199
PartialEq::ne(*self, *other)

0 commit comments

Comments
 (0)