Skip to content

Commit

Permalink
Fix clippy lints for main crate & derive
Browse files Browse the repository at this point in the history
The `clippy::missing_safety_doc` lint has been set to #[allow(...)]
  • Loading branch information
Techcable committed Apr 12, 2024
1 parent 07201cd commit 863c492
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 19 deletions.
14 changes: 8 additions & 6 deletions libs/derive/src/derive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@ use syn::{

use crate::{FromLitStr, MetaList};

type ExpandFunc<'a> = &'a mut dyn FnMut(
TraceDeriveKind,
Option<Generics>,
&Path,
&Lifetime,
) -> Result<TokenStream, Error>;

#[derive(Copy, Clone, Debug)]
pub enum TraceDeriveKind {
NullTrace,
Expand Down Expand Up @@ -792,12 +799,7 @@ impl TraceDeriveInput {
generics: Generics,
kind: TraceDeriveKind,
gc_lifetime: Lifetime,
func: &mut dyn FnMut(
TraceDeriveKind,
Option<Generics>,
&Path,
&Lifetime,
) -> Result<TokenStream, Error>,
func: ExpandFunc<'_>,
) -> Result<TokenStream, Error> {
let mut has_explicit_collector_ids = false;
let mut impls = Vec::new();
Expand Down
17 changes: 7 additions & 10 deletions libs/derive/src/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,13 @@ fn empty_clause() -> WhereClause {
}
}

#[derive(Clone, Debug)]
#[derive(Clone, Debug, Default)]
pub enum CollectorIdInfo {
#[default]
Any,
Specific { map: IndexMap<Path, Lifetime> },
}
impl Default for CollectorIdInfo {
fn default() -> Self {
CollectorIdInfo::Any
}
Specific {
map: IndexMap<Path, Lifetime>,
},
}
impl CollectorIdInfo {
/// Create info from a single `CollectorId`,
Expand Down Expand Up @@ -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(),
Expand Down Expand Up @@ -1066,8 +1064,7 @@ fn rewrite_type(
*qself = qself
.clone()
.map::<Result<_, Error>, _>(|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()?;
Expand Down
2 changes: 1 addition & 1 deletion src/array/repr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ impl<Id: CollectorId> FatArrayPtr<Id> {
/// 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<Id: CollectorId> Copy for FatArrayPtr<Id> {}
Expand Down
2 changes: 1 addition & 1 deletion src/epsilon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ unsafe impl GcContext for EpsilonContext {
state: self.state,
root: false,
};
func(&mut child, &mut *value)
func(&mut child, *value)
}

#[inline]
Expand Down
2 changes: 1 addition & 1 deletion src/epsilon/handle.rs
Original file line number Diff line number Diff line change
@@ -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};

Expand Down
3 changes: 3 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 863c492

Please sign in to comment.