Skip to content

Commit

Permalink
Fix Default for UnorderedSet
Browse files Browse the repository at this point in the history
Summary: `UnorderedSet<T>` should implement `Default` even if `T` does not.

Reviewed By: JakobDegen

Differential Revision: D52788856

fbshipit-source-id: 10e9bc554696369e6ff63b4f73ea173421c6893e
  • Loading branch information
stepancheg authored and facebook-github-bot committed Jan 17, 2024
1 parent 69a5467 commit 0d57ed3
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion starlark_map/src/unordered_set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,18 @@ use crate::unordered_map::UnorderedMap;
use crate::Equivalent;

/// `HashSet` that does not expose insertion order.
#[derive(Clone, Allocative, Debug, Default)]
#[derive(Clone, Allocative, Debug)]
pub struct UnorderedSet<T> {
map: UnorderedMap<T, ()>,
}

impl<T> Default for UnorderedSet<T> {
#[inline]
fn default() -> UnorderedSet<T> {
UnorderedSet::new()
}
}

impl<T> UnorderedSet<T> {
/// Create a new empty set.
#[inline]
Expand Down

0 comments on commit 0d57ed3

Please sign in to comment.