Skip to content

Commit

Permalink
cleanup method trait bounds
Browse files Browse the repository at this point in the history
  • Loading branch information
al8n committed Oct 3, 2024
1 parent 0d05aae commit 756b339
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
20 changes: 10 additions & 10 deletions src/swmr/generic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ where
{
#[inline]
fn equivalent(&self, p: &GenericPointer<K, V>) -> bool {
let kr = unsafe { <K::Ref<'_> as TypeRef<'_>>::from_slice(p.as_key_slice()) };
let kr = unsafe { <K::Ref<'b> as TypeRef<'b>>::from_slice(p.as_key_slice()) };
Equivalent::equivalent(self.key, &kr)

Check warning on line 160 in src/swmr/generic.rs

View check run for this annotation

Codecov / codecov/patch

src/swmr/generic.rs#L158-L160

Added lines #L158 - L160 were not covered by tests
}
}
Expand All @@ -169,7 +169,7 @@ where
{
#[inline]
fn compare(&self, p: &GenericPointer<K, V>) -> cmp::Ordering {
let kr = unsafe { <K::Ref<'_> as TypeRef<'_>>::from_slice(p.as_key_slice()) };
let kr = unsafe { <K::Ref<'b> as TypeRef<'b>>::from_slice(p.as_key_slice()) };
Comparable::compare(self.key, &kr)
}
}
Expand Down Expand Up @@ -294,9 +294,9 @@ where
V: ?Sized,
{
#[inline]
fn contains_key<'a, 'b: 'a, Q>(&'a self, key: &'b Q) -> bool
fn contains_key<'a, Q>(&'a self, key: &Q) -> bool
where
Q: ?Sized + Ord + Comparable<K::Ref<'b>>,
Q: ?Sized + Ord + Comparable<K::Ref<'a>>,
{
self.map.contains::<Query<'_, K, Q>>(&Query::new(key))
}
Expand All @@ -307,9 +307,9 @@ where
}

#[inline]
fn get<'a, 'b: 'a, Q>(&'a self, key: &'b Q) -> Option<GenericEntryRef<'a, K, V>>
fn get<'a, Q>(&'a self, key: &Q) -> Option<GenericEntryRef<'a, K, V>>
where
Q: ?Sized + Ord + Comparable<K::Ref<'b>>,
Q: ?Sized + Ord + Comparable<K::Ref<'a>>,
{
self
.map

Check warning on line 315 in src/swmr/generic.rs

View check run for this annotation

Codecov / codecov/patch

src/swmr/generic.rs#L315

Added line #L315 was not covered by tests
Expand Down Expand Up @@ -474,9 +474,9 @@ where
{
/// Returns `true` if the key exists in the WAL.
#[inline]
pub fn contains_key<'a, 'b: 'a, Q>(&'a self, key: &'b Q) -> bool
pub fn contains_key<'a, Q>(&'a self, key: &Q) -> bool
where
Q: ?Sized + Ord + Comparable<K::Ref<'b>>,
Q: ?Sized + Ord + Comparable<K::Ref<'a>>,
{
self.core.contains_key(key)
}
Expand All @@ -492,9 +492,9 @@ where

/// Gets the value associated with the key.
#[inline]
pub fn get<'a, 'b: 'a, Q>(&'a self, key: &'b Q) -> Option<GenericEntryRef<'a, K, V>>
pub fn get<'a, Q>(&'a self, key: &Q) -> Option<GenericEntryRef<'a, K, V>>
where
Q: ?Sized + Ord + Comparable<K::Ref<'b>>,
Q: ?Sized + Ord + Comparable<K::Ref<'a>>,
{
self.core.get(key)
}
Expand Down
8 changes: 4 additions & 4 deletions src/swmr/generic/reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,9 @@ where
{
/// Returns `true` if the key exists in the WAL.
#[inline]
pub fn contains_key<Q>(&self, key: &Q) -> bool
pub fn contains_key<'a, Q>(&'a self, key: &Q) -> bool
where
Q: ?Sized + Ord + for<'b> Comparable<K::Ref<'b>>,
Q: ?Sized + Ord + Comparable<K::Ref<'a>>,
{
self.0.contains_key(key)
}
Expand All @@ -125,9 +125,9 @@ where

/// Gets the value associated with the key.
#[inline]
pub fn get<'a, 'b: 'a, Q>(&'a self, key: &'b Q) -> Option<GenericEntryRef<'a, K, V>>
pub fn get<'a, Q>(&'a self, key: &Q) -> Option<GenericEntryRef<'a, K, V>>
where
Q: ?Sized + Ord + Comparable<K::Ref<'b>>,
Q: ?Sized + Ord + Comparable<K::Ref<'a>>,
{
self.0.get(key)
}
Expand Down

0 comments on commit 756b339

Please sign in to comment.