Skip to content

Commit

Permalink
ArcIntern should not implement Borrow because it hashes differently
Browse files Browse the repository at this point in the history
  • Loading branch information
droundy committed Apr 10, 2024
1 parent 4add6b5 commit 7e7daa5
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 17 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "internment"
version = "0.7.5"
version = "0.8.0"
authors = ["David Roundy <daveroundy@gmail.com>"]
edition = "2018"

Expand Down
6 changes: 0 additions & 6 deletions src/arc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -289,12 +289,6 @@ impl<T: ?Sized + Eq + Hash + Send + Sync> Deref for ArcIntern<T> {
}
}

impl<T: ?Sized + Eq + Hash + Send + Sync> Borrow<T> for ArcIntern<T> {
fn borrow(&self) -> &T {
self.as_ref()
}
}

impl<T: ?Sized + Eq + Hash + Send + Sync + Display> Display for ArcIntern<T> {
fn fmt(&self, f: &mut std::fmt::Formatter) -> Result<(), std::fmt::Error> {
self.deref().fmt(f)
Expand Down
10 changes: 0 additions & 10 deletions src/arc_dst.rs
Original file line number Diff line number Diff line change
Expand Up @@ -312,16 +312,6 @@ fn dst_arc_intern_is_clone() {
ArcIntern<str>: Clone;
}

#[test]
fn dst_arc_intern_is_borrow() {
// demonstrate that Arc has this ability
let map = std::collections::HashMap::<std::sync::Arc<str>, u32>::new();
assert!(map.get("dst_arc_intern_is_borrow").is_none());

let map = std::collections::HashMap::<ArcIntern<str>, u32>::new();
assert!(map.get("dst_arc_intern_is_borrow").is_none());
}

#[test]
fn dst_arc_intern_is_send_and_sync() {
struct _Assure
Expand Down

0 comments on commit 7e7daa5

Please sign in to comment.