fix: Do not compare references to pointers to compare pointers (#3236)

`self` and `other` are references, and the `ptr::eq()` call intends to
determine if they designate the same object. Putting them behind another
level of reference will always return `false`, as those short-lived
references will be compared instead.
This commit is contained in:
Samuel Tardieu
2025-05-30 11:35:40 +02:00
committed by GitHub
parent 1619fa89ec
commit ab355f6133

View File

@@ -448,7 +448,7 @@ impl Eq for Metadata<'_> {}
impl PartialEq for Metadata<'_> {
#[inline]
fn eq(&self, other: &Self) -> bool {
if core::ptr::eq(&self, &other) {
if core::ptr::eq(self, other) {
true
} else if cfg!(not(debug_assertions)) {
// In a well-behaving application, two `Metadata` can be assumed to