Skip to content

Commit a13a16b

Browse files
committed
add #[inline(always)] to From<HashMap> impl
1 parent 85eb39a commit a13a16b

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

crates/oxc_allocator/src/hash_set.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,11 @@ impl<T> Eq for HashSet<'_, T> where T: Eq + Hash {}
198198

199199
// Note: `Index` and `Extend` are implemented via `Deref`
200200

201+
/// Convert `HashMap<T, ()>` to `HashSet<T>`.
202+
///
203+
/// This conversion is zero cost, as `HashSet<T>` is just a wrapper around `HashMap<T, ()>`.
201204
impl<'alloc, T> From<HashMap<'alloc, T, ()>> for HashSet<'alloc, T> {
205+
#[inline(always)]
202206
fn from(map: HashMap<'alloc, T, ()>) -> Self {
203207
let inner_map = ManuallyDrop::into_inner(map.0);
204208
let inner_set = hashbrown::HashSet::from(inner_map);

0 commit comments

Comments
 (0)