diff options
author | 2020-12-16 21:51:13 -0800 | |
---|---|---|
committer | 2020-12-16 21:51:13 -0800 | |
commit | 54f5ced6c58c47f721836a9444654de4c8d687a1 (patch) | |
tree | 1f4778909ca9ad0d24490974fa48002412bb3bd4 | |
parent | bd78f193935bc53539a1c0399712968f630f0678 (diff) | |
download | bytes-54f5ced6c58c47f721836a9444654de4c8d687a1.tar.gz bytes-54f5ced6c58c47f721836a9444654de4c8d687a1.tar.zst bytes-54f5ced6c58c47f721836a9444654de4c8d687a1.zip |
remove unused Buf implementation. (#449)
The implementation of `Buf` for `Option<[u8; 1]>` was added to support
`IntoBuf`. The `IntoBuf` trait has since been removed.
Closes #444
-rw-r--r-- | benches/buf.rs | 1 | ||||
-rw-r--r-- | src/buf/buf_impl.rs | 29 |
2 files changed, 0 insertions, 30 deletions
diff --git a/benches/buf.rs b/benches/buf.rs index 77b0633..4b5d286 100644 --- a/benches/buf.rs +++ b/benches/buf.rs @@ -159,7 +159,6 @@ macro_rules! bench_group { mod get_u8 { use super::*; bench_group!(get_u8); - bench!(option, option); } mod get_u16 { use super::*; diff --git a/src/buf/buf_impl.rs b/src/buf/buf_impl.rs index 04c2f7c..3c596f1 100644 --- a/src/buf/buf_impl.rs +++ b/src/buf/buf_impl.rs @@ -1032,35 +1032,6 @@ impl Buf for &[u8] { } } -impl Buf for Option<[u8; 1]> { - fn remaining(&self) -> usize { - if self.is_some() { - 1 - } else { - 0 - } - } - - fn bytes(&self) -> &[u8] { - self.as_ref() - .map(AsRef::as_ref) - .unwrap_or(Default::default()) - } - - fn advance(&mut self, cnt: usize) { - if cnt == 0 { - return; - } - - if self.is_none() { - panic!("overflow"); - } else { - assert_eq!(1, cnt); - *self = None; - } - } -} - #[cfg(feature = "std")] impl<T: AsRef<[u8]>> Buf for std::io::Cursor<T> { fn remaining(&self) -> usize { |