Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove unused Buf implementation. #449

Merged
merged 2 commits into from
Dec 17, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion benches/buf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::*;
Expand Down
29 changes: 0 additions & 29 deletions src/buf/buf_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down