Skip to content

Commit

Permalink
Apply Clippy's suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
powergee committed Nov 15, 2024
1 parent bef6d05 commit 9495cf1
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 22 deletions.
10 changes: 5 additions & 5 deletions src/ebr_impl/pointers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -217,15 +217,15 @@ pub(crate) struct RawShared<'g, T> {
_marker: PhantomData<&'g T>,
}

impl<'g, T> Clone for RawShared<'g, T> {
impl<T> Clone for RawShared<'_, T> {
fn clone(&self) -> Self {
*self
}
}

impl<'g, T> Copy for RawShared<'g, T> {}
impl<T> Copy for RawShared<'_, T> {}

impl<'g, T> From<*const T> for RawShared<'g, T> {
impl<T> From<*const T> for RawShared<'_, T> {
fn from(value: *const T) -> Self {
Self {
inner: Tagged::from(value),
Expand All @@ -234,7 +234,7 @@ impl<'g, T> From<*const T> for RawShared<'g, T> {
}
}

impl<'g, T> From<*mut T> for RawShared<'g, T> {
impl<T> From<*mut T> for RawShared<'_, T> {
fn from(value: *mut T) -> Self {
Self {
inner: Tagged::from(value),
Expand All @@ -243,7 +243,7 @@ impl<'g, T> From<*mut T> for RawShared<'g, T> {
}
}

impl<'g, T> From<Tagged<T>> for RawShared<'g, T> {
impl<T> From<Tagged<T>> for RawShared<'_, T> {
fn from(inner: Tagged<T>) -> Self {
Self {
inner,
Expand Down
22 changes: 11 additions & 11 deletions src/strong.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ impl<'r> EdgeTaker<'r> {
pub fn take<T: RcObject>(&mut self, outgoing: &mut impl OwnRc<T>) {
let rc = outgoing.take().into_raw();
self.popped.push(TryIRD {
rc: unsafe { transmute::<_, Raw<()>>(rc) },
rc: unsafe { transmute::<Raw<T>, Raw<()>>(rc) },
ird: try_ird_with_raw::<T>,
});
}
Expand Down Expand Up @@ -790,13 +790,13 @@ pub struct Snapshot<'g, T> {
pub(crate) _marker: PhantomData<&'g T>,
}

impl<'g, T> Clone for Snapshot<'g, T> {
impl<T> Clone for Snapshot<'_, T> {
fn clone(&self) -> Self {
*self
}
}

impl<'g, T> Copy for Snapshot<'g, T> {}
impl<T> Copy for Snapshot<'_, T> {}

impl<'g, T: RcObject> Snapshot<'g, T> {
/// Returns `true` if the pointer is null ignoring the tag.
Expand Down Expand Up @@ -921,41 +921,41 @@ impl<'g, T> Snapshot<'g, T> {
}
}

impl<'g, T: RcObject> Default for Snapshot<'g, T> {
impl<T: RcObject> Default for Snapshot<'_, T> {
#[inline]
fn default() -> Self {
Self::null()
}
}

impl<'g, T: RcObject + PartialEq> PartialEq for Snapshot<'g, T> {
impl<T: RcObject + PartialEq> PartialEq for Snapshot<'_, T> {
#[inline(always)]
fn eq(&self, other: &Self) -> bool {
self.as_ref() == other.as_ref()
}
}

impl<'g, T: RcObject + Eq> Eq for Snapshot<'g, T> {}
impl<T: RcObject + Eq> Eq for Snapshot<'_, T> {}

impl<'g, T: RcObject + Hash> Hash for Snapshot<'g, T> {
impl<T: RcObject + Hash> Hash for Snapshot<'_, T> {
fn hash<H: Hasher>(&self, state: &mut H) {
self.as_ref().hash(state);
}
}

impl<'g, T: RcObject + PartialOrd> PartialOrd for Snapshot<'g, T> {
impl<T: RcObject + PartialOrd> PartialOrd for Snapshot<'_, T> {
fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
self.as_ref().partial_cmp(&other.as_ref())
}
}

impl<'g, T: RcObject + Ord> Ord for Snapshot<'g, T> {
impl<T: RcObject + Ord> Ord for Snapshot<'_, T> {
fn cmp(&self, other: &Self) -> std::cmp::Ordering {
self.as_ref().cmp(&other.as_ref())
}
}

impl<'g, T: RcObject + Debug> Debug for Snapshot<'g, T> {
impl<T: RcObject + Debug> Debug for Snapshot<'_, T> {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
if let Some(cnt) = self.as_ref() {
f.debug_tuple("RcObject").field(cnt).finish()
Expand All @@ -965,7 +965,7 @@ impl<'g, T: RcObject + Debug> Debug for Snapshot<'g, T> {
}
}

impl<'g, T: RcObject> Pointer for Snapshot<'g, T> {
impl<T: RcObject> Pointer for Snapshot<'_, T> {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
Pointer::fmt(&self.ptr, f)
}
Expand Down
6 changes: 5 additions & 1 deletion src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -448,5 +448,9 @@ pub(crate) unsafe fn try_ird_with_raw<T: RcObject>(
ctx: DisposeContext<'_>,
succ_epoch: u32,
) {
try_imm_recur_destr(Rc::from_raw(transmute::<_, Raw<T>>(next)), ctx, succ_epoch);
try_imm_recur_destr(
Rc::from_raw(transmute::<Raw<()>, Raw<T>>(next)),
ctx,
succ_epoch,
);
}
10 changes: 5 additions & 5 deletions src/weak.rs
Original file line number Diff line number Diff line change
Expand Up @@ -435,13 +435,13 @@ pub struct WeakSnapshot<'g, T> {
pub(crate) _marker: PhantomData<&'g T>,
}

impl<'g, T> Clone for WeakSnapshot<'g, T> {
impl<T> Clone for WeakSnapshot<'_, T> {
fn clone(&self) -> Self {
*self
}
}

impl<'g, T> Copy for WeakSnapshot<'g, T> {}
impl<T> Copy for WeakSnapshot<'_, T> {}

impl<'g, T> WeakSnapshot<'g, T> {
/// Returns `true` if the pointer is null ignoring the tag.
Expand Down Expand Up @@ -519,7 +519,7 @@ impl<'g, T> WeakSnapshot<'g, T> {
}
}

impl<'g, T> Default for WeakSnapshot<'g, T> {
impl<T> Default for WeakSnapshot<'_, T> {
#[inline]
fn default() -> Self {
Self::null()
Expand All @@ -532,13 +532,13 @@ impl<'g, T: RcObject> From<Snapshot<'g, T>> for WeakSnapshot<'g, T> {
}
}

impl<'g, T> Debug for WeakSnapshot<'g, T> {
impl<T> Debug for WeakSnapshot<'_, T> {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
Debug::fmt(&self.ptr, f)
}
}

impl<'g, T> Pointer for WeakSnapshot<'g, T> {
impl<T> Pointer for WeakSnapshot<'_, T> {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
Pointer::fmt(&self.ptr, f)
}
Expand Down

0 comments on commit 9495cf1

Please sign in to comment.