Skip to content

Commit

Permalink
Anonymize the lifetimes
Browse files Browse the repository at this point in the history
  • Loading branch information
Kerollmops committed Dec 10, 2024
1 parent 22c2768 commit 9fbb578
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 27 deletions.
28 changes: 14 additions & 14 deletions src/alloc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,13 @@ impl<'bump> Deref for RefBump<'bump> {
}
}

impl<'bump> DerefMut for RefBump<'bump> {
impl DerefMut for RefBump<'_> {
fn deref_mut(&mut self) -> &mut Self::Target {
&mut self.0
}
}

unsafe impl<'bump> Allocator for RefBump<'bump> {
unsafe impl Allocator for RefBump<'_> {
#[inline]
fn allocate(
&self,
Expand Down Expand Up @@ -139,35 +139,35 @@ unsafe impl<'bump> Allocator for RefBump<'bump> {
#[derive(Debug)]
pub struct RefStr<'bump>(pub Ref<'bump, str>);

impl<'bump> std::hash::Hash for RefStr<'bump> {
impl std::hash::Hash for RefStr<'_> {
fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
self.0.hash(state);
}
}

impl<'bump> PartialEq for RefStr<'bump> {
impl PartialEq for RefStr<'_> {
fn eq(&self, other: &Self) -> bool {
self.0.deref() == other.0.deref()
}
}

impl<'bump> Eq for RefStr<'bump> {}
impl Eq for RefStr<'_> {}

impl<'bump> Borrow<str> for RefStr<'bump> {
impl Borrow<str> for RefStr<'_> {
fn borrow(&self) -> &str {
self
}
}

impl<'bump> Deref for RefStr<'bump> {
impl Deref for RefStr<'_> {
type Target = str;

fn deref(&self) -> &Self::Target {
&self.0
}
}

impl<'bump> AsRef<str> for RefStr<'bump> {
impl AsRef<str> for RefStr<'_> {
fn as_ref(&self) -> &str {
self
}
Expand All @@ -177,35 +177,35 @@ impl<'bump> AsRef<str> for RefStr<'bump> {
#[derive(Debug)]
pub struct RefBytes<'bump>(pub Ref<'bump, [u8]>);

impl<'bump> std::hash::Hash for RefBytes<'bump> {
impl std::hash::Hash for RefBytes<'_> {
fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
self.0.hash(state);
}
}

impl<'bump> PartialEq for RefBytes<'bump> {
impl PartialEq for RefBytes<'_> {
fn eq(&self, other: &Self) -> bool {
self.0.deref() == other.0.deref()
}
}

impl<'bump> Eq for RefBytes<'bump> {}
impl Eq for RefBytes<'_> {}

impl<'bump> Borrow<[u8]> for RefBytes<'bump> {
impl Borrow<[u8]> for RefBytes<'_> {
fn borrow(&self) -> &[u8] {
self
}
}

impl<'bump> Deref for RefBytes<'bump> {
impl Deref for RefBytes<'_> {
type Target = [u8];

fn deref(&self) -> &Self::Target {
&self.0
}
}

impl<'bump> AsRef<[u8]> for RefBytes<'bump> {
impl AsRef<[u8]> for RefBytes<'_> {
fn as_ref(&self) -> &[u8] {
self
}
Expand Down
2 changes: 1 addition & 1 deletion src/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ pub struct RawMap<'bump> {
cache: hashbrown::HashMap<&'bump str, usize, DefaultHashBuilder, &'bump Bump>,
}

impl<'bump> Serialize for RawMap<'bump> {
impl Serialize for RawMap<'_> {
#[inline]
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
Expand Down
8 changes: 4 additions & 4 deletions src/map/frozen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pub struct FrozenMap<'a, 'bump, K, V, S>(&'a mut hashbrown::HashMap<K, V, S, &'b
/// - The FrozenMap does not leak a shared reference to the allocator **or its inner hashmap**.
///
/// So, it is safe to send the contained shared reference to the allocator
unsafe impl<'a, 'bump, K, V, S> Send for FrozenMap<'a, 'bump, K, V, S>
unsafe impl<K, V, S> Send for FrozenMap<'_, '_, K, V, S>
where
K: Send,
V: Send,
Expand Down Expand Up @@ -81,7 +81,7 @@ impl<'a, 'bump, K, V, S> FrozenMap<'a, 'bump, K, V, S> {
}
}

impl<'a, 'bump, K, V, S> FrozenMap<'a, 'bump, K, V, S>
impl<K, V, S> FrozenMap<'_, '_, K, V, S>
where
K: Eq + Hash,
S: std::hash::BuildHasher,
Expand Down Expand Up @@ -211,7 +211,7 @@ where
}
}

impl<'a, 'bump, K, V, S> FrozenMap<'a, 'bump, K, V, S> {
impl<'bump, K, V, S> FrozenMap<'_, 'bump, K, V, S> {
/// Creates a raw immutable entry builder for the map.
///
/// Raw entries provide the lowest level of control for searching and manipulating a map. They must be manually initialized with a hash and then manually searched.
Expand Down Expand Up @@ -257,7 +257,7 @@ pub struct FrozenRawEntryBuilderMut<'a, 'bump, K, V, S>(
RawEntryBuilderMut<'a, K, V, S, &'bump Bump>,
);

impl<'a, 'bump, K, V, S> FrozenRawEntryBuilderMut<'a, 'bump, K, V, S> {
impl<'a, K, V, S> FrozenRawEntryBuilderMut<'a, '_, K, V, S> {
/// Creates a [`FrozenRawEntryBuilderMut`] from the given key.
#[allow(clippy::wrong_self_convention)] // blame hashbrown
#[inline]
Expand Down
6 changes: 3 additions & 3 deletions src/map/iter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use crate::RawMap;
///
/// Iterates in first-insertion order.
pub struct Keys<'bump, 'a>(std::slice::Iter<'a, (&'bump str, &'bump RawValue)>);
impl<'a, 'bump> Iterator for Keys<'bump, 'a> {
impl<'bump> Iterator for Keys<'bump, '_> {
type Item = &'bump str;

#[inline]
Expand All @@ -19,7 +19,7 @@ impl<'a, 'bump> Iterator for Keys<'bump, 'a> {
///
/// Iterates in first-insertion order.
pub struct Values<'bump, 'a>(std::slice::Iter<'a, (&'bump str, &'bump RawValue)>);
impl<'a, 'bump> Iterator for Values<'bump, 'a> {
impl<'bump> Iterator for Values<'bump, '_> {
type Item = &'bump RawValue;

#[inline]
Expand All @@ -32,7 +32,7 @@ impl<'a, 'bump> Iterator for Values<'bump, 'a> {
///
/// Iterates in first-insertion order.
pub struct Iter<'bump, 'a>(std::slice::Iter<'a, (&'bump str, &'bump RawValue)>);
impl<'bump, 'a> Iterator for Iter<'bump, 'a> {
impl<'bump> Iterator for Iter<'bump, '_> {
type Item = (&'bump str, &'bump RawValue);

#[inline]
Expand Down
6 changes: 3 additions & 3 deletions src/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,19 +51,19 @@ fn test_ref_allocator() {
fn test_ref_map() {
struct RefStr<'bump>(pub Ref<'bump, str>);

impl<'bump> std::hash::Hash for RefStr<'bump> {
impl std::hash::Hash for RefStr<'_> {
fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
self.0.hash(state);
}
}

impl<'bump> PartialEq for RefStr<'bump> {
impl PartialEq for RefStr<'_> {
fn eq(&self, other: &Self) -> bool {
self.0.deref() == other.0.deref()
}
}

impl<'bump> Eq for RefStr<'bump> {}
impl Eq for RefStr<'_> {}

let bump = RefCell::new(Bump::new());
let bump_ref = RefBump::new(bump.borrow());
Expand Down
2 changes: 1 addition & 1 deletion src/vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ pub mod iter;
#[derive(Debug)]
pub struct RawVec<'bump>(BVec<'bump, &'bump RawValue>);

impl<'bump> Serialize for RawVec<'bump> {
impl Serialize for RawVec<'_> {
#[inline]
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
Expand Down
2 changes: 1 addition & 1 deletion src/vec/iter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use crate::RawVec;

/// An iterator over the values of a [`RawVec`].
pub struct Iter<'bump, 'a>(std::slice::Iter<'a, &'bump RawValue>);
impl<'bump, 'a> Iterator for Iter<'bump, 'a> {
impl<'bump> Iterator for Iter<'bump, '_> {
type Item = &'bump RawValue;

#[inline]
Expand Down

0 comments on commit 9fbb578

Please sign in to comment.