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

Commit c9b32c5

Browse files
committed
Remove implementation of Deref
According to the Rust docs [0] on the `Deref` trait, it should only be implemented for smart pointers. Remove the implementation of `Deref`. [0] https://doc.rust-lang.org/std/ops/trait.Deref.html
1 parent 701daf6 commit c9b32c5

File tree

1 file changed

+3
-11
lines changed

1 file changed

+3
-11
lines changed

src/util.rs

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ macro_rules! hex_fmt_impl(
2525
use $crate::{Hash as _, HashEngine as _, hex};
2626

2727
if $ty::<$($gen),*>::DISPLAY_BACKWARD {
28-
hex::format_hex_reverse(&self.0, f)
28+
hex::format_hex_reverse(self.as_ref(), f)
2929
} else {
30-
hex::format_hex(&self.0, f)
30+
hex::format_hex(self.as_ref(), f)
3131
}
3232
}
3333
}
@@ -52,14 +52,6 @@ macro_rules! borrow_slice_impl(
5252
&self[..]
5353
}
5454
}
55-
56-
impl<$($gen: $gent),*> $crate::_export::_core::ops::Deref for $ty<$($gen),*> {
57-
type Target = [u8];
58-
59-
fn deref(&self) -> &Self::Target {
60-
&self.0
61-
}
62-
}
6355
)
6456
);
6557

@@ -295,7 +287,7 @@ mod test {
295287
fn borrow_slice_impl_to_vec() {
296288
// Test that the borrow_slice_impl macro gives to_vec.
297289
let hash = sha256::Hash::hash(&[3, 50]);
298-
assert_eq!(hash.to_vec().len(), sha256::Hash::LEN);
290+
assert_eq!(hash.as_ref().len(), sha256::Hash::LEN);
299291
}
300292

301293
#[test]

0 commit comments

Comments
 (0)