Skip to content

Commit

Permalink
Merge pull request #121 from jeromefroe/jerome/fix-lifetimes-of-itera…
Browse files Browse the repository at this point in the history
…tors

Fix lifetimes of iterators
  • Loading branch information
jeromefroe committed Dec 18, 2021
2 parents 09f68c6 + 416a2d4 commit 3c6fdf0
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/lib.rs
Expand Up @@ -684,7 +684,7 @@ impl<K: Hash + Eq, V, S: BuildHasher> LruCache<K, V, S> {
}

/// An iterator visiting all entries in most-recently used order. The iterator element type is
/// `(&'a K, &'a V)`.
/// `(&K, &V)`.
///
/// # Examples
///
Expand All @@ -700,7 +700,7 @@ impl<K: Hash + Eq, V, S: BuildHasher> LruCache<K, V, S> {
/// println!("key: {} val: {}", key, val);
/// }
/// ```
pub fn iter<'a>(&'_ self) -> Iter<'a, K, V> {
pub fn iter(&self) -> Iter<'_, K, V> {
Iter {
len: self.len(),
ptr: unsafe { (*self.head).next },
Expand All @@ -710,7 +710,7 @@ impl<K: Hash + Eq, V, S: BuildHasher> LruCache<K, V, S> {
}

/// An iterator visiting all entries in most-recently-used order, giving a mutable reference on
/// V. The iterator element type is `(&'a K, &'a mut V)`.
/// V. The iterator element type is `(&K, &mut V)`.
///
/// # Examples
///
Expand All @@ -735,7 +735,7 @@ impl<K: Hash + Eq, V, S: BuildHasher> LruCache<K, V, S> {
/// }
/// }
/// ```
pub fn iter_mut<'a>(&'_ mut self) -> IterMut<'a, K, V> {
pub fn iter_mut(&mut self) -> IterMut<'_, K, V> {
IterMut {
len: self.len(),
ptr: unsafe { (*self.head).next },
Expand Down

0 comments on commit 3c6fdf0

Please sign in to comment.