Skip to content

Commit

Permalink
Unimpl Eq for VecMap
Browse files Browse the repository at this point in the history
Summary: Map comparison is trick (ordered vs unordered), so remove this unused implementations to avoid using them accidentally.

Reviewed By: ndmitchell

Differential Revision: D41166332

fbshipit-source-id: aee935e98d5ec13aa2910bee83ebaa1b07faff1d
  • Loading branch information
stepancheg authored and facebook-github-bot committed Nov 10, 2022
1 parent 302ceb0 commit 7b3841f
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 9 deletions.
8 changes: 0 additions & 8 deletions starlark-rust/starlark_map/src/vec2/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,14 +83,6 @@ pub(crate) struct Vec2<K, V> {
unsafe impl<K: Send, V: Send> Send for Vec2<K, V> {}
unsafe impl<K: Sync, V: Sync> Sync for Vec2<K, V> {}

impl<K: PartialEq, V: PartialEq> PartialEq for Vec2<K, V> {
fn eq(&self, other: &Self) -> bool {
self.len == other.len && self.iter().eq(other.iter())
}
}

impl<K: Eq, V: Eq> Eq for Vec2<K, V> {}

impl<K, V> Default for Vec2<K, V> {
#[inline]
fn default() -> Vec2<K, V> {
Expand Down
2 changes: 1 addition & 1 deletion starlark-rust/starlark_map/src/vec_map/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ impl<K: Hash, V: Hash> Hash for Bucket<K, V> {
}
}

#[derive(Debug, Clone, Eq, PartialEq, Default_, Allocative)]
#[derive(Debug, Clone, Default_, Allocative)]
pub(crate) struct VecMap<K, V> {
buckets: Vec2<(K, V), StarlarkHashValue>,
}
Expand Down

0 comments on commit 7b3841f

Please sign in to comment.