Skip to content
This repository was archived by the owner on Nov 30, 2022. It is now read-only.

Commit 39863ec

Browse files
authored
Merge pull request #55 from stevenroose/fix-deref
Change Deref<Inner> impl for Hashes to Deref<[u8]>
2 parents a175a9e + 7812a74 commit 39863ec

File tree

8 files changed

+10
-10
lines changed

8 files changed

+10
-10
lines changed

src/hash160.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ hex_fmt_impl!(Display, Hash);
3535
hex_fmt_impl!(LowerHex, Hash);
3636
index_impl!(Hash);
3737
serde_impl!(Hash, 20);
38-
borrow_slice_impl!(Hash, [u8; 20]);
38+
borrow_slice_impl!(Hash);
3939

4040
impl str::FromStr for Hash {
4141
type Err = Error;

src/ripemd160.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ hex_fmt_impl!(Display, Hash);
7676
hex_fmt_impl!(LowerHex, Hash);
7777
index_impl!(Hash);
7878
serde_impl!(Hash, 20);
79-
borrow_slice_impl!(Hash, [u8; 20]);
79+
borrow_slice_impl!(Hash);
8080

8181
impl str::FromStr for Hash {
8282
type Err = Error;

src/sha1.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ hex_fmt_impl!(Display, Hash);
6363
hex_fmt_impl!(LowerHex, Hash);
6464
index_impl!(Hash);
6565
serde_impl!(Hash, 20);
66-
borrow_slice_impl!(Hash, [u8; 20]);
66+
borrow_slice_impl!(Hash);
6767

6868
impl str::FromStr for Hash {
6969
type Err = Error;

src/sha256.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ hex_fmt_impl!(Display, Hash);
7979
hex_fmt_impl!(LowerHex, Hash);
8080
index_impl!(Hash);
8181
serde_impl!(Hash, 32);
82-
borrow_slice_impl!(Hash, [u8; 32]);
82+
borrow_slice_impl!(Hash);
8383

8484
impl HashTrait for Hash {
8585
type Engine = HashEngine;
@@ -151,7 +151,7 @@ hex_fmt_impl!(Display, Midstate);
151151
hex_fmt_impl!(LowerHex, Midstate);
152152
index_impl!(Midstate);
153153
serde_impl!(Midstate, 32);
154-
borrow_slice_impl!(Midstate, [u8; 32]);
154+
borrow_slice_impl!(Midstate);
155155

156156
impl Midstate {
157157
/// Length of the midstate, in bytes.

src/sha256d.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ hex_fmt_impl!(Display, Hash);
2929
hex_fmt_impl!(LowerHex, Hash);
3030
index_impl!(Hash);
3131
serde_impl!(Hash, 32);
32-
borrow_slice_impl!(Hash, [u8; 32]);
32+
borrow_slice_impl!(Hash);
3333

3434
impl str::FromStr for Hash {
3535
type Err = Error;

src/sha512.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ hex_fmt_impl!(Display, Hash);
127127
hex_fmt_impl!(LowerHex, Hash);
128128
index_impl!(Hash);
129129
serde_impl!(Hash, 64);
130-
borrow_slice_impl!(Hash, [u8; 64]);
130+
borrow_slice_impl!(Hash);
131131

132132
impl HashTrait for Hash {
133133
type Engine = HashEngine;

src/siphash24.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ hex_fmt_impl!(Display, Hash);
209209
hex_fmt_impl!(LowerHex, Hash);
210210
index_impl!(Hash);
211211
serde_impl!(Hash, 8);
212-
borrow_slice_impl!(Hash, [u8; 8]);
212+
borrow_slice_impl!(Hash);
213213

214214
impl str::FromStr for Hash {
215215
type Err = Error;

src/util.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ macro_rules! index_impl(
7676
);
7777

7878
macro_rules! borrow_slice_impl(
79-
($ty:ty, $inner:ty) => (
79+
($ty:ty) => (
8080
impl ::std::borrow::Borrow<[u8]> for $ty {
8181
fn borrow(&self) -> &[u8] {
8282
&self[..]
@@ -90,7 +90,7 @@ macro_rules! borrow_slice_impl(
9090
}
9191

9292
impl ::std::ops::Deref for $ty {
93-
type Target = $inner;
93+
type Target = [u8];
9494

9595
fn deref(&self) -> &Self::Target {
9696
&self.0

0 commit comments

Comments
 (0)