Skip to content

Commit

Permalink
Fix new lints
Browse files Browse the repository at this point in the history
  • Loading branch information
nhusung committed Oct 12, 2024
1 parent 7a64d8c commit 3dabf72
Show file tree
Hide file tree
Showing 15 changed files with 133 additions and 147 deletions.
30 changes: 13 additions & 17 deletions crates/arcslab/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -745,7 +745,7 @@ pub struct IntHandle<'a, I: AtomicRefCounted, D, const PAGE_SIZE: usize>(
PhantomData<(D, &'a ())>,
);

impl<'a, I: AtomicRefCounted, D, const PAGE_SIZE: usize> IntHandle<'a, I, D, PAGE_SIZE> {
impl<I: AtomicRefCounted, D, const PAGE_SIZE: usize> IntHandle<'_, I, D, PAGE_SIZE> {
/// Move the referenced item out in case `this` is the last reference,
/// otherwise return `None`
#[inline]
Expand Down Expand Up @@ -793,22 +793,22 @@ impl<'a, I: AtomicRefCounted, D, const PAGE_SIZE: usize> IntHandle<'a, I, D, PAG
}
}

impl<'a, I: AtomicRefCounted, D, const PAGE_SIZE: usize> Clone for IntHandle<'a, I, D, PAGE_SIZE> {
impl<I: AtomicRefCounted, D, const PAGE_SIZE: usize> Clone for IntHandle<'_, I, D, PAGE_SIZE> {
#[inline]
fn clone(&self) -> Self {
unsafe { Slot::retain(self.0) };
Self(self.0, PhantomData)
}
}

impl<'a, I: AtomicRefCounted, D, const PAGE_SIZE: usize> Drop for IntHandle<'a, I, D, PAGE_SIZE> {
impl<I: AtomicRefCounted, D, const PAGE_SIZE: usize> Drop for IntHandle<'_, I, D, PAGE_SIZE> {
#[inline]
fn drop(&mut self) {
unsafe { Slot::release::<D, PAGE_SIZE>(self.0, |_| {}) };
}
}

impl<'a, I: AtomicRefCounted, D, const PAGE_SIZE: usize> Deref for IntHandle<'a, I, D, PAGE_SIZE> {
impl<I: AtomicRefCounted, D, const PAGE_SIZE: usize> Deref for IntHandle<'_, I, D, PAGE_SIZE> {
type Target = I;

#[inline]
Expand All @@ -818,43 +818,39 @@ impl<'a, I: AtomicRefCounted, D, const PAGE_SIZE: usize> Deref for IntHandle<'a,
}
}

impl<'a, I: AtomicRefCounted, D, const PAGE_SIZE: usize> PartialEq
for IntHandle<'a, I, D, PAGE_SIZE>
{
impl<I: AtomicRefCounted, D, const PAGE_SIZE: usize> PartialEq for IntHandle<'_, I, D, PAGE_SIZE> {
#[inline]
fn eq(&self, other: &Self) -> bool {
self.0 == other.0
}
}
impl<'a, I: AtomicRefCounted, D, const PAGE_SIZE: usize> Eq for IntHandle<'a, I, D, PAGE_SIZE> {}
impl<I: AtomicRefCounted, D, const PAGE_SIZE: usize> Eq for IntHandle<'_, I, D, PAGE_SIZE> {}

impl<'a, I: AtomicRefCounted, D, const PAGE_SIZE: usize> PartialOrd
for IntHandle<'a, I, D, PAGE_SIZE>
{
impl<I: AtomicRefCounted, D, const PAGE_SIZE: usize> PartialOrd for IntHandle<'_, I, D, PAGE_SIZE> {
#[inline]
fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
Some(self.0.cmp(&other.0))
}
}
impl<'a, I: AtomicRefCounted, D, const PAGE_SIZE: usize> Ord for IntHandle<'a, I, D, PAGE_SIZE> {
impl<I: AtomicRefCounted, D, const PAGE_SIZE: usize> Ord for IntHandle<'_, I, D, PAGE_SIZE> {
#[inline]
fn cmp(&self, other: &Self) -> std::cmp::Ordering {
self.0.cmp(&other.0)
}
}

impl<'a, I: AtomicRefCounted, D, const PAGE_SIZE: usize> Hash for IntHandle<'a, I, D, PAGE_SIZE> {
impl<I: AtomicRefCounted, D, const PAGE_SIZE: usize> Hash for IntHandle<'_, I, D, PAGE_SIZE> {
fn hash<H: Hasher>(&self, state: &mut H) {
self.0.hash(state);
}
}

unsafe impl<'a, I: AtomicRefCounted + Send + Sync, D: Send + Sync, const PAGE_SIZE: usize> Send
for IntHandle<'a, I, D, PAGE_SIZE>
unsafe impl<I: AtomicRefCounted + Send + Sync, D: Send + Sync, const PAGE_SIZE: usize> Send
for IntHandle<'_, I, D, PAGE_SIZE>
{
}
unsafe impl<'a, I: AtomicRefCounted + Send + Sync, D: Send + Sync, const PAGE_SIZE: usize> Sync
for IntHandle<'a, I, D, PAGE_SIZE>
unsafe impl<I: AtomicRefCounted + Send + Sync, D: Send + Sync, const PAGE_SIZE: usize> Sync
for IntHandle<'_, I, D, PAGE_SIZE>
{
}

Expand Down
16 changes: 8 additions & 8 deletions crates/linear-hashtbl/src/raw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -810,14 +810,14 @@ impl<'a, T, S: Status> Iterator for Iter<'a, T, S> {
}
}

impl<'a, T, S: Status> ExactSizeIterator for Iter<'a, T, S> {
impl<T, S: Status> ExactSizeIterator for Iter<'_, T, S> {
#[inline]
fn len(&self) -> usize {
self.len
}
}

impl<'a, T, S: Status> FusedIterator for Iter<'a, T, S> {}
impl<T, S: Status> FusedIterator for Iter<'_, T, S> {}

// --- IterMut -----------------------------------------------------------------

Expand Down Expand Up @@ -850,14 +850,14 @@ impl<'a, T, S: Status> Iterator for IterMut<'a, T, S> {
}
}

impl<'a, T, S: Status> ExactSizeIterator for IterMut<'a, T, S> {
impl<T, S: Status> ExactSizeIterator for IterMut<'_, T, S> {
#[inline]
fn len(&self) -> usize {
self.len
}
}

impl<'a, T, S: Status> FusedIterator for IterMut<'a, T, S> {}
impl<T, S: Status> FusedIterator for IterMut<'_, T, S> {}

// --- IntoIter ----------------------------------------------------------------

Expand Down Expand Up @@ -920,7 +920,7 @@ impl<T, S: Status, A: Allocator> Drop for IntoIter<T, S, A> {

// --- Drain -------------------------------------------------------------------

impl<'a, T, S: Status> Iterator for Drain<'a, T, S> {
impl<T, S: Status> Iterator for Drain<'_, T, S> {
type Item = T;

#[inline]
Expand Down Expand Up @@ -952,16 +952,16 @@ impl<'a, T, S: Status> Iterator for Drain<'a, T, S> {
}
}

impl<'a, T, S: Status> ExactSizeIterator for Drain<'a, T, S> {
impl<T, S: Status> ExactSizeIterator for Drain<'_, T, S> {
#[inline]
fn len(&self) -> usize {
self.len
}
}

impl<'a, T, S: Status> FusedIterator for Drain<'a, T, S> {}
impl<T, S: Status> FusedIterator for Drain<'_, T, S> {}

impl<'a, T, S: Status> Drop for Drain<'a, T, S> {
impl<T, S: Status> Drop for Drain<'_, T, S> {
fn drop(&mut self) {
while self.len != 0 {
let next = self.iter.next();
Expand Down
6 changes: 3 additions & 3 deletions crates/oxidd-cache/src/direct.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,15 +122,15 @@ impl<M: Manager, O: Copy + Eq, const ARITY: usize> Entry<M, O, ARITY> {
}
}

impl<'a, M: Manager, O, const ARITY: usize> Drop for EntryGuard<'a, M, O, ARITY> {
impl<M: Manager, O, const ARITY: usize> Drop for EntryGuard<'_, M, O, ARITY> {
#[inline]
fn drop(&mut self) {
// SAFETY: The entry is locked.
unsafe { self.0.mutex.unlock() }
}
}

impl<'a, M: Manager, O, const ARITY: usize> EntryGuard<'a, M, O, ARITY>
impl<M: Manager, O, const ARITY: usize> EntryGuard<'_, M, O, ARITY>
where
O: Copy + Eq,
{
Expand Down Expand Up @@ -436,7 +436,7 @@ where
}
}

impl<'a, M, O, const ARITY: usize> fmt::Debug for EntryGuard<'a, M, O, ARITY>
impl<M, O, const ARITY: usize> fmt::Debug for EntryGuard<'_, M, O, ARITY>
where
M: Manager,
M::Edge: fmt::Debug,
Expand Down
48 changes: 24 additions & 24 deletions crates/oxidd-manager-index/src/manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ unsafe impl<

// --- Edge Impls --------------------------------------------------------------

impl<'id, N: NodeBase, ET: Tag> Edge<'id, N, ET> {
impl<N: NodeBase, ET: Tag> Edge<'_, N, ET> {
const TAG_BITS: u32 = {
let bits = usize::BITS - ET::MAX_VALUE.leading_zeros();
assert!(bits <= 16, "Maximum value of edge tag is too large");
Expand Down Expand Up @@ -360,37 +360,37 @@ impl<'id, N: NodeBase, ET: Tag> Edge<'id, N, ET> {
}
}

impl<'id, N, ET> PartialEq for Edge<'id, N, ET> {
impl<N, ET> PartialEq for Edge<'_, N, ET> {
#[inline(always)]
fn eq(&self, other: &Self) -> bool {
self.0 == other.0
}
}

impl<'id, N, ET> Eq for Edge<'id, N, ET> {}
impl<N, ET> Eq for Edge<'_, N, ET> {}

impl<'id, N, ET> PartialOrd for Edge<'id, N, ET> {
impl<N, ET> PartialOrd for Edge<'_, N, ET> {
#[inline(always)]
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
Some(self.0.cmp(&other.0))
}
}

impl<'id, N, ET> Ord for Edge<'id, N, ET> {
impl<N, ET> Ord for Edge<'_, N, ET> {
#[inline(always)]
fn cmp(&self, other: &Self) -> Ordering {
self.0.cmp(&other.0)
}
}

impl<'id, N, ET> Hash for Edge<'id, N, ET> {
impl<N, ET> Hash for Edge<'_, N, ET> {
#[inline(always)]
fn hash<H: Hasher>(&self, state: &mut H) {
self.0.hash(state);
}
}

impl<'id, N: NodeBase, ET: Tag> oxidd_core::Edge for Edge<'id, N, ET> {
impl<N: NodeBase, ET: Tag> oxidd_core::Edge for Edge<'_, N, ET> {
type Tag = ET;

#[inline]
Expand Down Expand Up @@ -423,7 +423,7 @@ impl<'id, N: NodeBase, ET: Tag> oxidd_core::Edge for Edge<'id, N, ET> {
}
}

impl<'id, N, ET> Drop for Edge<'id, N, ET> {
impl<N, ET> Drop for Edge<'_, N, ET> {
#[inline(never)]
#[cold]
fn drop(&mut self) {
Expand Down Expand Up @@ -826,8 +826,8 @@ where

// --- LocalStoreStateGuard impl -----------------------------------------------

impl<'a, 'id, N, ET, TM, R, MD, const TERMINALS: usize> Drop
for LocalStoreStateGuard<'a, 'id, N, ET, TM, R, MD, TERMINALS>
impl<'id, N, ET, TM, R, MD, const TERMINALS: usize> Drop
for LocalStoreStateGuard<'_, 'id, N, ET, TM, R, MD, TERMINALS>
where
N: NodeBase + InnerNode<Edge<'id, N, ET>>,
ET: Tag,
Expand Down Expand Up @@ -1370,8 +1370,8 @@ where
}
}

impl<'id, N, ET, TM, R, MD, const TERMINALS: usize> Drop
for LevelViewSet<'id, N, ET, TM, R, MD, TERMINALS>
impl<N, ET, TM, R, MD, const TERMINALS: usize> Drop
for LevelViewSet<'_, N, ET, TM, R, MD, TERMINALS>
{
#[inline]
fn drop(&mut self) {
Expand All @@ -1381,8 +1381,8 @@ impl<'id, N, ET, TM, R, MD, const TERMINALS: usize> Drop
}
}

impl<'id, N, ET, TM, R, MD, const TERMINALS: usize> Default
for LevelViewSet<'id, N, ET, TM, R, MD, TERMINALS>
impl<N, ET, TM, R, MD, const TERMINALS: usize> Default
for LevelViewSet<'_, N, ET, TM, R, MD, TERMINALS>
{
#[inline]
fn default() -> Self {
Expand Down Expand Up @@ -1421,7 +1421,7 @@ impl<'a, 'id, N, ET> Iterator for LevelViewIter<'a, 'id, N, ET> {
}
}

impl<'a, 'id, N, ET> ExactSizeIterator for LevelViewIter<'a, 'id, N, ET> {
impl<N, ET> ExactSizeIterator for LevelViewIter<'_, '_, N, ET> {
#[inline(always)]
fn len(&self) -> usize {
self.0.len()
Expand Down Expand Up @@ -1562,9 +1562,9 @@ where
set: LevelViewSet<'id, N, ET, TM, R, MD, TERMINALS>,
}

unsafe impl<'a, 'id, N, ET, TM, R, MD, const TERMINALS: usize>
unsafe impl<'id, N, ET, TM, R, MD, const TERMINALS: usize>
oxidd_core::LevelView<Edge<'id, N, ET>, N>
for TakenLevelView<'a, 'id, N, ET, TM, R, MD, TERMINALS>
for TakenLevelView<'_, 'id, N, ET, TM, R, MD, TERMINALS>
where
N: NodeBase + InnerNode<Edge<'id, N, ET>>,
ET: Tag,
Expand Down Expand Up @@ -1669,8 +1669,8 @@ where
}
}

impl<'a, 'id, N, ET, TM, R, MD, const TERMINALS: usize> Drop
for TakenLevelView<'a, 'id, N, ET, TM, R, MD, TERMINALS>
impl<'id, N, ET, TM, R, MD, const TERMINALS: usize> Drop
for TakenLevelView<'_, 'id, N, ET, TM, R, MD, TERMINALS>
where
N: NodeBase + InnerNode<Edge<'id, N, ET>>,
ET: Tag,
Expand Down Expand Up @@ -1733,8 +1733,8 @@ where
}
}

impl<'a, 'id, N, ET, TM, R, MD, const TERMINALS: usize> ExactSizeIterator
for LevelIter<'a, 'id, N, ET, TM, R, MD, TERMINALS>
impl<'id, N, ET, TM, R, MD, const TERMINALS: usize> ExactSizeIterator
for LevelIter<'_, 'id, N, ET, TM, R, MD, TERMINALS>
where
N: NodeBase + InnerNode<Edge<'id, N, ET>>,
ET: Tag,
Expand All @@ -1757,8 +1757,8 @@ where
{
}

impl<'a, 'id, N, ET, TM, R, MD, const TERMINALS: usize> DoubleEndedIterator
for LevelIter<'a, 'id, N, ET, TM, R, MD, TERMINALS>
impl<'id, N, ET, TM, R, MD, const TERMINALS: usize> DoubleEndedIterator
for LevelIter<'_, 'id, N, ET, TM, R, MD, TERMINALS>
where
N: NodeBase + InnerNode<Edge<'id, N, ET>>,
ET: Tag,
Expand Down Expand Up @@ -2444,7 +2444,7 @@ impl<'id, N: NodeBase, ET: Tag> oxidd_core::util::NodeSet<Edge<'id, N, ET>> for
}
}

/// === Additional Trait Implementations =======================================
// === Additional Trait Implementations ========================================

impl<
'id,
Expand Down
14 changes: 7 additions & 7 deletions crates/oxidd-manager-index/src/node/fixed_arity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,16 @@ impl<'id, ET: Tag, const ARITY: usize> NodeWithLevel<'id, ET, ARITY> {
const UNINIT_EDGE: MaybeUninit<manager::Edge<'id, Self, ET>> = MaybeUninit::uninit();
}

impl<'id, ET: Tag, const ARITY: usize> PartialEq for NodeWithLevel<'id, ET, ARITY> {
impl<ET: Tag, const ARITY: usize> PartialEq for NodeWithLevel<'_, ET, ARITY> {
#[inline(always)]
fn eq(&self, other: &Self) -> bool {
// SAFETY: we have shared access to the node
unsafe { *self.children.get() == *other.children.get() }
}
}
impl<'id, ET: Tag, const ARITY: usize> Eq for NodeWithLevel<'id, ET, ARITY> {}
impl<ET: Tag, const ARITY: usize> Eq for NodeWithLevel<'_, ET, ARITY> {}

impl<'id, ET: Tag, const ARITY: usize> Hash for NodeWithLevel<'id, ET, ARITY> {
impl<ET: Tag, const ARITY: usize> Hash for NodeWithLevel<'_, ET, ARITY> {
#[inline(always)]
fn hash<H: Hasher>(&self, state: &mut H) {
// SAFETY: we have shared access to the node
Expand All @@ -54,7 +54,7 @@ impl<'id, ET: Tag, const ARITY: usize> Hash for NodeWithLevel<'id, ET, ARITY> {
// order
// - No other functions modify the reference counter.
// - `Self::load_rc()` loads the reference counter with the given `order`
unsafe impl<'id, ET: Tag, const ARITY: usize> NodeBase for NodeWithLevel<'id, ET, ARITY> {
unsafe impl<ET: Tag, const ARITY: usize> NodeBase for NodeWithLevel<'_, ET, ARITY> {
#[inline(always)]
fn retain(&self) {
if self.rc.fetch_add(1, Relaxed) > (u32::MAX >> 1) {
Expand Down Expand Up @@ -173,7 +173,7 @@ impl<'id, ET: Tag, const ARITY: usize> InnerNode<manager::Edge<'id, Self, ET>>
}
}

unsafe impl<'id, ET, const ARITY: usize> HasLevel for NodeWithLevel<'id, ET, ARITY> {
unsafe impl<ET, const ARITY: usize> HasLevel for NodeWithLevel<'_, ET, ARITY> {
#[inline(always)]
fn level(&self) -> LevelNo {
self.level.load(Relaxed)
Expand All @@ -185,8 +185,8 @@ unsafe impl<'id, ET, const ARITY: usize> HasLevel for NodeWithLevel<'id, ET, ARI
}
}

unsafe impl<'id, ET: Send + Sync, const ARITY: usize> Send for NodeWithLevel<'id, ET, ARITY> {}
unsafe impl<'id, ET: Send + Sync, const ARITY: usize> Sync for NodeWithLevel<'id, ET, ARITY> {}
unsafe impl<ET: Send + Sync, const ARITY: usize> Send for NodeWithLevel<'_, ET, ARITY> {}
unsafe impl<ET: Send + Sync, const ARITY: usize> Sync for NodeWithLevel<'_, ET, ARITY> {}

pub struct NodeWithLevelCons<const ARITY: usize>;
impl<ET: Tag + Send + Sync, const ARITY: usize> InnerNodeCons<ET> for NodeWithLevelCons<ARITY> {
Expand Down
Loading

0 comments on commit 3dabf72

Please sign in to comment.