Skip to content

Commit 54f5ced

Browse files
authored
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
1 parent bd78f19 commit 54f5ced

File tree

2 files changed

+0
-30
lines changed

2 files changed

+0
-30
lines changed

benches/buf.rs

-1
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,6 @@ macro_rules! bench_group {
159159
mod get_u8 {
160160
use super::*;
161161
bench_group!(get_u8);
162-
bench!(option, option);
163162
}
164163
mod get_u16 {
165164
use super::*;

src/buf/buf_impl.rs

-29
Original file line numberDiff line numberDiff line change
@@ -1032,35 +1032,6 @@ impl Buf for &[u8] {
10321032
}
10331033
}
10341034

1035-
impl Buf for Option<[u8; 1]> {
1036-
fn remaining(&self) -> usize {
1037-
if self.is_some() {
1038-
1
1039-
} else {
1040-
0
1041-
}
1042-
}
1043-
1044-
fn bytes(&self) -> &[u8] {
1045-
self.as_ref()
1046-
.map(AsRef::as_ref)
1047-
.unwrap_or(Default::default())
1048-
}
1049-
1050-
fn advance(&mut self, cnt: usize) {
1051-
if cnt == 0 {
1052-
return;
1053-
}
1054-
1055-
if self.is_none() {
1056-
panic!("overflow");
1057-
} else {
1058-
assert_eq!(1, cnt);
1059-
*self = None;
1060-
}
1061-
}
1062-
}
1063-
10641035
#[cfg(feature = "std")]
10651036
impl<T: AsRef<[u8]>> Buf for std::io::Cursor<T> {
10661037
fn remaining(&self) -> usize {

0 commit comments

Comments
 (0)