Skip to content

Commit 3ff913b

Browse files
committed
Fix clippy lints for main crate & derive
The `clippy::missing_safety_doc` lint has been set to #[allow(...)]
1 parent f800d49 commit 3ff913b

File tree

6 files changed

+21
-19
lines changed

6 files changed

+21
-19
lines changed

libs/derive/src/derive.rs

+8-6
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,13 @@ use syn::{
1414

1515
use crate::{FromLitStr, MetaList};
1616

17+
type ExpandFunc<'a> = &'a mut dyn FnMut(
18+
TraceDeriveKind,
19+
Option<Generics>,
20+
&Path,
21+
&Lifetime,
22+
) -> Result<TokenStream, Error>;
23+
1724
#[derive(Copy, Clone, Debug)]
1825
pub enum TraceDeriveKind {
1926
NullTrace,
@@ -792,12 +799,7 @@ impl TraceDeriveInput {
792799
generics: Generics,
793800
kind: TraceDeriveKind,
794801
gc_lifetime: Lifetime,
795-
func: &mut dyn FnMut(
796-
TraceDeriveKind,
797-
Option<Generics>,
798-
&Path,
799-
&Lifetime,
800-
) -> Result<TokenStream, Error>,
802+
func: ExpandFunc<'_>,
801803
) -> Result<TokenStream, Error> {
802804
let mut has_explicit_collector_ids = false;
803805
let mut impls = Vec::new();

libs/derive/src/macros.rs

+7-10
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,13 @@ fn empty_clause() -> WhereClause {
2828
}
2929
}
3030

31-
#[derive(Clone, Debug)]
31+
#[derive(Clone, Debug, Default)]
3232
pub enum CollectorIdInfo {
33+
#[default]
3334
Any,
34-
Specific { map: IndexMap<Path, Lifetime> },
35-
}
36-
impl Default for CollectorIdInfo {
37-
fn default() -> Self {
38-
CollectorIdInfo::Any
39-
}
35+
Specific {
36+
map: IndexMap<Path, Lifetime>,
37+
},
4038
}
4139
impl CollectorIdInfo {
4240
/// Create info from a single `CollectorId`,
@@ -154,7 +152,7 @@ impl MacroInput {
154152
if let Some(closure) = self
155153
.trace_immutable_closure
156154
.as_ref()
157-
.or_else(|| self.trace_mut_closure.as_ref())
155+
.or(self.trace_mut_closure.as_ref())
158156
{
159157
return Err(Error::new(
160158
closure.0.body.span(),
@@ -1066,8 +1064,7 @@ fn rewrite_type(
10661064
*qself = qself
10671065
.clone()
10681066
.map::<Result<_, Error>, _>(|mut qself| {
1069-
qself.ty =
1070-
Box::new(rewrite_type(&*qself.ty, target_type_name, &mut *rewriter)?);
1067+
qself.ty = Box::new(rewrite_type(&qself.ty, target_type_name, &mut *rewriter)?);
10711068
Ok(qself)
10721069
})
10731070
.transpose()?;

src/array/repr.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ impl<Id: CollectorId> FatArrayPtr<Id> {
105105
/// Get the length of this fat array (stored inline)
106106
#[inline]
107107
pub const fn len(&self) -> usize {
108-
unsafe { (&*self.slice.as_ptr()).len() }
108+
unsafe { (*self.slice.as_ptr()).len() }
109109
}
110110
}
111111
impl<Id: CollectorId> Copy for FatArrayPtr<Id> {}

src/epsilon.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ unsafe impl GcContext for EpsilonContext {
153153
state: self.state,
154154
root: false,
155155
};
156-
func(&mut child, &mut *value)
156+
func(&mut child, *value)
157157
}
158158

159159
#[inline]

src/epsilon/handle.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use std::ptr::NonNull;
22
use std::rc::Rc;
33

4-
use crate::{prelude::*, HandleCollectorId};
4+
use crate::prelude::*;
55

66
use super::{EpsilonCollectorId, EpsilonContext, EpsilonSystem, State};
77

src/lib.rs

+3
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
#![feature(maybe_uninit_slice)]
1616
#![feature(new_uninit)]
1717
#![deny(missing_docs)]
18+
#![allow(
19+
clippy::missing_safety_doc, // TODO: Add missing safety docs and make this #[deny(...)]
20+
)]
1821
#![cfg_attr(not(feature = "std"), no_std)]
1922
//! Zero overhead tracing garbage collection for rust,
2023
//! by abusing the borrow checker.

0 commit comments

Comments
 (0)