diff --git a/libs/derive/src/derive.rs b/libs/derive/src/derive.rs index 3c5ce8e..6610810 100644 --- a/libs/derive/src/derive.rs +++ b/libs/derive/src/derive.rs @@ -14,6 +14,13 @@ use syn::{ use crate::{FromLitStr, MetaList}; +type ExpandFunc<'a> = &'a mut dyn FnMut( + TraceDeriveKind, + Option, + &Path, + &Lifetime, +) -> Result; + #[derive(Copy, Clone, Debug)] pub enum TraceDeriveKind { NullTrace, @@ -792,12 +799,7 @@ impl TraceDeriveInput { generics: Generics, kind: TraceDeriveKind, gc_lifetime: Lifetime, - func: &mut dyn FnMut( - TraceDeriveKind, - Option, - &Path, - &Lifetime, - ) -> Result, + func: ExpandFunc<'_>, ) -> Result { let mut has_explicit_collector_ids = false; let mut impls = Vec::new(); diff --git a/libs/derive/src/macros.rs b/libs/derive/src/macros.rs index ae7eb97..a40ac41 100644 --- a/libs/derive/src/macros.rs +++ b/libs/derive/src/macros.rs @@ -28,15 +28,13 @@ fn empty_clause() -> WhereClause { } } -#[derive(Clone, Debug)] +#[derive(Clone, Debug, Default)] pub enum CollectorIdInfo { + #[default] Any, - Specific { map: IndexMap }, -} -impl Default for CollectorIdInfo { - fn default() -> Self { - CollectorIdInfo::Any - } + Specific { + map: IndexMap, + }, } impl CollectorIdInfo { /// Create info from a single `CollectorId`, @@ -154,7 +152,7 @@ impl MacroInput { if let Some(closure) = self .trace_immutable_closure .as_ref() - .or_else(|| self.trace_mut_closure.as_ref()) + .or(self.trace_mut_closure.as_ref()) { return Err(Error::new( closure.0.body.span(), @@ -1066,8 +1064,7 @@ fn rewrite_type( *qself = qself .clone() .map::, _>(|mut qself| { - qself.ty = - Box::new(rewrite_type(&*qself.ty, target_type_name, &mut *rewriter)?); + qself.ty = Box::new(rewrite_type(&qself.ty, target_type_name, &mut *rewriter)?); Ok(qself) }) .transpose()?; diff --git a/src/array/repr.rs b/src/array/repr.rs index d45fe4e..b1495a1 100644 --- a/src/array/repr.rs +++ b/src/array/repr.rs @@ -105,7 +105,7 @@ impl FatArrayPtr { /// Get the length of this fat array (stored inline) #[inline] pub const fn len(&self) -> usize { - unsafe { (&*self.slice.as_ptr()).len() } + unsafe { (*self.slice.as_ptr()).len() } } } impl Copy for FatArrayPtr {} diff --git a/src/epsilon.rs b/src/epsilon.rs index 6de0761..017ed62 100644 --- a/src/epsilon.rs +++ b/src/epsilon.rs @@ -153,7 +153,7 @@ unsafe impl GcContext for EpsilonContext { state: self.state, root: false, }; - func(&mut child, &mut *value) + func(&mut child, *value) } #[inline] diff --git a/src/epsilon/handle.rs b/src/epsilon/handle.rs index d31f88a..bf89d8e 100644 --- a/src/epsilon/handle.rs +++ b/src/epsilon/handle.rs @@ -1,7 +1,7 @@ use std::ptr::NonNull; use std::rc::Rc; -use crate::{prelude::*, HandleCollectorId}; +use crate::prelude::*; use super::{EpsilonCollectorId, EpsilonContext, EpsilonSystem, State}; diff --git a/src/lib.rs b/src/lib.rs index 6e4b5cf..6731e39 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -15,6 +15,9 @@ #![feature(maybe_uninit_slice)] #![feature(new_uninit)] #![deny(missing_docs)] +#![allow( + clippy::missing_safety_doc, // TODO: Add missing safety docs and make this #[deny(...)] +)] #![cfg_attr(not(feature = "std"), no_std)] //! Zero overhead tracing garbage collection for rust, //! by abusing the borrow checker.