Skip to content

Commit

Permalink
Add proper lifetime to OccupiedEntry::get
Browse files Browse the repository at this point in the history
  • Loading branch information
ChosenName committed Nov 29, 2024
1 parent 6a4ed03 commit 2082249
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3816,7 +3816,7 @@ impl<'a, K, V, S, A: Allocator> OccupiedEntry<'a, K, V, S, A> {
/// }
/// ```
#[cfg_attr(feature = "inline-more", inline)]
pub fn get(&self) -> &V {
pub fn get(&self) -> &'a V {
unsafe { &self.elem.as_ref().1 }
}

Expand Down Expand Up @@ -3848,7 +3848,7 @@ impl<'a, K, V, S, A: Allocator> OccupiedEntry<'a, K, V, S, A> {
/// assert_eq!(map["poneyland"], 24);
/// ```
#[cfg_attr(feature = "inline-more", inline)]
pub fn get_mut(&mut self) -> &mut V {
pub fn get_mut(&mut self) -> &'a mut V {
unsafe { &mut self.elem.as_mut().1 }
}

Expand Down

0 comments on commit 2082249

Please sign in to comment.