Skip to content

Commit

Permalink
Make HashSet::insert return OccupiedEntry
Browse files Browse the repository at this point in the history
  • Loading branch information
SUPERCILEX committed Feb 2, 2024
1 parent f2e6212 commit de6a22b
Showing 1 changed file with 2 additions and 11 deletions.
13 changes: 2 additions & 11 deletions src/set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2247,7 +2247,7 @@ impl<'a, T, S, A: Allocator> Entry<'a, T, S, A> {
{
match self {
Entry::Occupied(entry) => entry,
Entry::Vacant(entry) => entry.insert_entry(),
Entry::Vacant(entry) => entry.insert(),
}
}

Expand Down Expand Up @@ -2442,16 +2442,7 @@ impl<'a, T, S, A: Allocator> VacantEntry<'a, T, S, A> {
/// assert!(set.contains("poneyland"));
/// ```
#[cfg_attr(feature = "inline-more", inline)]
pub fn insert(self)
where
T: Hash,
S: BuildHasher,
{
self.inner.insert(());
}

#[cfg_attr(feature = "inline-more", inline)]
fn insert_entry(self) -> OccupiedEntry<'a, T, S, A>
pub fn insert(self) -> OccupiedEntry<'a, T, S, A>
where
T: Hash,
S: BuildHasher,
Expand Down

0 comments on commit de6a22b

Please sign in to comment.