Skip to content

Commit

Permalink
Fixed new clippy lints.
Browse files Browse the repository at this point in the history
  • Loading branch information
orium committed Dec 4, 2024
1 parent aac8370 commit abc1c64
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 17 deletions.
4 changes: 2 additions & 2 deletions src/list/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ where
length: usize,
}

impl<'a, T, P> IterPtr<'a, T, P>
impl<T, P> IterPtr<'_, T, P>
where
P: SharedPointerKind,
{
Expand Down Expand Up @@ -466,7 +466,7 @@ where
}
}

impl<'a, T, P> ExactSizeIterator for IterPtr<'a, T, P> where P: SharedPointerKind {}
impl<T, P> ExactSizeIterator for IterPtr<'_, T, P> where P: SharedPointerKind {}

#[cfg(feature = "serde")]
pub mod serde {
Expand Down
4 changes: 3 additions & 1 deletion src/list/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -336,8 +336,10 @@ fn test_clone() {
fn test_drop_list() {
// When it is dropped, it will set the variable it owned to false.
use core::cell::Cell;

struct DropStruct<'a>(&'a Cell<bool>);
impl<'a> Drop for DropStruct<'a> {

impl Drop for DropStruct<'_> {
fn drop(&mut self) {
self.0.set(false);
}
Expand Down
6 changes: 3 additions & 3 deletions src/map/hash_trie_map/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -913,7 +913,7 @@ where
}
}

impl<'a, K, Q: ?Sized, V, P, H: BuildHasher> Index<&'a Q> for HashTrieMap<K, V, P, H>
impl<K, Q: ?Sized, V, P, H: BuildHasher> Index<&Q> for HashTrieMap<K, V, P, H>
where
K: Eq + Hash + Borrow<Q>,
Q: Hash + Eq,
Expand Down Expand Up @@ -1101,7 +1101,7 @@ mod iter_utils {
}
}

impl<'a, K, V, P> IterPtr<'a, K, V, P>
impl<K, V, P> IterPtr<'_, K, V, P>
where
K: Eq + Hash,
P: SharedPointerKind,
Expand Down Expand Up @@ -1149,7 +1149,7 @@ where
}
}

impl<'a, K: Eq + Hash, V, P> ExactSizeIterator for IterPtr<'a, K, V, P> where P: SharedPointerKind {}
impl<K: Eq + Hash, V, P> ExactSizeIterator for IterPtr<'_, K, V, P> where P: SharedPointerKind {}

#[cfg(feature = "serde")]
pub mod serde {
Expand Down
16 changes: 8 additions & 8 deletions src/map/red_black_tree_map/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,8 @@ where
Node { entry: SharedPointer::new(entry), color: Color::Black, left: None, right: None }
}

fn borrow(node: &Option<SharedPointer<Node<K, V, P>, P>>) -> Option<&Node<K, V, P>> {
node.as_ref().map(Borrow::borrow)
fn borrow(node: Option<&SharedPointer<Node<K, V, P>, P>>) -> Option<&Node<K, V, P>> {
node.map(Borrow::borrow)
}

fn left_color(&self) -> Option<Color> {
Expand Down Expand Up @@ -990,7 +990,7 @@ where
}
}

impl<'a, K, Q: ?Sized, V, P> Index<&'a Q> for RedBlackTreeMap<K, V, P>
impl<K, Q: ?Sized, V, P> Index<&Q> for RedBlackTreeMap<K, V, P>
where
K: Ord + Borrow<Q>,
Q: Ord,
Expand Down Expand Up @@ -1227,7 +1227,7 @@ mod iter_utils {
Q: Ord + ?Sized,
{
let child = self.stack.last().and_then(|node| {
let c = if self.backwards { &node.right } else { &node.left };
let c = if self.backwards { node.right.as_ref() } else { node.left.as_ref() };
Node::borrow(c)
});

Expand Down Expand Up @@ -1284,7 +1284,7 @@ mod iter_utils {
Q: Ord + ?Sized,
{
if let Some(node) = self.stack.pop() {
let child = if self.backwards { &node.left } else { &node.right };
let child = if self.backwards { node.left.as_ref() } else { node.right.as_ref() };

if let Some(c) = Node::borrow(child) {
self.stack.push(c);
Expand Down Expand Up @@ -1324,7 +1324,7 @@ where
size: usize,
}

impl<'a, K, V, P> IterPtr<'a, K, V, P>
impl<K, V, P> IterPtr<'_, K, V, P>
where
K: Ord,
P: SharedPointerKind,
Expand Down Expand Up @@ -1370,7 +1370,7 @@ where
}
}

impl<'a, K: Ord, V, P> ExactSizeIterator for IterPtr<'a, K, V, P> where P: SharedPointerKind {}
impl<K: Ord, V, P> ExactSizeIterator for IterPtr<'_, K, V, P> where P: SharedPointerKind {}

#[derive(Debug)]
pub struct RangeIterPtr<'a, K, V, RB, Q: ?Sized, P>
Expand All @@ -1393,7 +1393,7 @@ where
RB: RangeBounds<Q>,
P: SharedPointerKind,
{
fn new(map: &'a RedBlackTreeMap<K, V, P>, range: RB) -> RangeIterPtr<'_, K, V, RB, Q, P> {
fn new(map: &'a RedBlackTreeMap<K, V, P>, range: RB) -> RangeIterPtr<'a, K, V, RB, Q, P> {
RangeIterPtr { map, stack_forward: None, stack_backward: None, range, _q: PhantomData }
}

Expand Down
4 changes: 2 additions & 2 deletions src/queue/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ where
Initialized { vec: Vec<&'a SharedPointer<T, P>>, current: Option<usize> },
}

impl<'a, T, P> LazilyReversedListIter<'a, T, P>
impl<T, P> LazilyReversedListIter<'_, T, P>
where
P: SharedPointerKind,
{
Expand Down Expand Up @@ -374,7 +374,7 @@ where
}
}

impl<'a, T, P> ExactSizeIterator for LazilyReversedListIter<'a, T, P> where P: SharedPointerKind {}
impl<T, P> ExactSizeIterator for LazilyReversedListIter<'_, T, P> where P: SharedPointerKind {}

#[cfg(feature = "serde")]
pub mod serde {
Expand Down
2 changes: 1 addition & 1 deletion src/vector/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -864,7 +864,7 @@ where
}
}

impl<'a, T, P> ExactSizeIterator for IterPtr<'a, T, P> where P: SharedPointerKind {}
impl<T, P> ExactSizeIterator for IterPtr<'_, T, P> where P: SharedPointerKind {}

#[cfg(feature = "serde")]
pub mod serde {
Expand Down

0 comments on commit abc1c64

Please sign in to comment.