Skip to content

Commit 4fbd377

Browse files
samueltardieuhds
authored andcommitted
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.
1 parent 0c5af12 commit 4fbd377

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

tracing-core/src/metadata.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,7 @@ impl Eq for Metadata<'_> {}
445445
impl PartialEq for Metadata<'_> {
446446
#[inline]
447447
fn eq(&self, other: &Self) -> bool {
448-
if core::ptr::eq(&self, &other) {
448+
if core::ptr::eq(self, other) {
449449
true
450450
} else if cfg!(not(debug_assertions)) {
451451
// In a well-behaving application, two `Metadata` can be assumed to

0 commit comments

Comments
 (0)