Skip to content

Commit 114acea

Browse files
committed
Simplify hashing example in traits post
1 parent 43deed8 commit 114acea

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

_posts/2015-05-11-traits.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -312,12 +312,9 @@ wind up playing a few other important roles in Rust. Here's a taste:
312312

313313
```rust
314314
struct Pair<A, B> { first: A, second: B }
315-
316315
impl<A: Hash, B: Hash> Hash for Pair<A, B> {
317316
fn hash(&self) -> u64 {
318-
self.first.hash()
319-
.xor(self.second.hash())
320-
.wrapping_mul(0x100000001b3);
317+
self.first.hash() ^ self.second.hash()
321318
}
322319
}
323320
```

0 commit comments

Comments
 (0)