From 0494c678be97c89505a98eb78bd07e6f4541852b Mon Sep 17 00:00:00 2001 From: Congyu Date: Thu, 21 Dec 2023 13:00:54 +0800 Subject: [PATCH] fix clippy --- src/lib.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index a9d3231..2b540b8 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -5,7 +5,7 @@ use std::{ mem::offset_of, ops::{Deref, DerefMut}, pin::Pin, - ptr::NonNull, + ptr::{self, NonNull}, }; /// Owned cell for data. @@ -174,7 +174,7 @@ impl ListHead { loop { f(this.get()); let next = this.next.unwrap(); - if next.as_ptr() as *const ListHead == self as *const ListHead { + if ptr::eq(next.as_ptr(), self) { break; } this = unsafe { next.as_ref() }; @@ -190,7 +190,7 @@ impl ListHead { loop { f(this.get_mut()); let mut next = this.next.unwrap(); - if next.as_ptr() as *const ListHead == self as *const ListHead { + if ptr::eq(next.as_ptr(), self) { break; } this = unsafe { next.as_mut() }; @@ -206,7 +206,7 @@ impl ListHead { loop { f(this.get()); let prev = this.prev.unwrap(); - if prev.as_ptr() as *const ListHead == self as *const ListHead { + if ptr::eq(prev.as_ptr(), self) { break; } this = unsafe { prev.as_ref() }; @@ -222,7 +222,7 @@ impl ListHead { loop { f(this.get_mut()); let mut prev = this.prev.unwrap(); - if prev.as_ptr() as *const ListHead == self as *const ListHead { + if ptr::eq(prev.as_ptr(), self) { break; } this = unsafe { prev.as_mut() };