Remove extra lifetime sigils

This commit is contained in:
Carl Lerche
2016-09-23 14:51:48 -07:00
parent 98e0d954b5
commit a7d38e29e5
5 changed files with 11 additions and 9 deletions
+1 -1
View File
@@ -99,7 +99,7 @@ impl MutBuf for AppendBuf {
} }
#[inline] #[inline]
unsafe fn mut_bytes<'a>(&'a mut self) -> &'a mut [u8] { unsafe fn mut_bytes(&mut self) -> &mut [u8] {
let wr = self.wr as usize; let wr = self.wr as usize;
let cap = self.cap as usize; let cap = self.cap as usize;
self.mem.mut_bytes_slice(wr, cap) self.mem.mut_bytes_slice(wr, cap)
+4 -4
View File
@@ -133,7 +133,7 @@ impl Buf for ByteBuf {
} }
#[inline] #[inline]
fn bytes<'a>(&'a self) -> &'a [u8] { fn bytes(&self) -> &[u8] {
unsafe { &self.mem.bytes()[self.pos()..self.lim()] } unsafe { &self.mem.bytes()[self.pos()..self.lim()] }
} }
@@ -212,7 +212,7 @@ impl MutByteBuf {
cnt cnt
} }
pub fn bytes<'a>(&'a self) -> &'a [u8] { pub fn bytes(&self) -> &[u8] {
unsafe { &self.buf.mem.bytes()[..self.buf.pos()] } unsafe { &self.buf.mem.bytes()[..self.buf.pos()] }
} }
} }
@@ -224,9 +224,9 @@ impl MutBuf for MutByteBuf {
unsafe fn advance(&mut self, cnt: usize) { unsafe fn advance(&mut self, cnt: usize) {
self.buf.advance(cnt) self.buf.advance(cnt)
}
unsafe fn mut_bytes<'a>(&'a mut self) -> &'a mut [u8] { }
unsafe fn mut_bytes(&mut self) -> &mut [u8] {
let pos = self.buf.pos(); let pos = self.buf.pos();
let lim = self.buf.lim(); let lim = self.buf.lim();
&mut self.buf.mem.mut_bytes()[pos..lim] &mut self.buf.mem.mut_bytes()[pos..lim]
+2 -2
View File
@@ -201,7 +201,7 @@ pub trait MutBuf {
/// length between 0 and `MutBuf::remaining()`. /// length between 0 and `MutBuf::remaining()`.
/// ///
/// The returned byte slice may represent uninitialized memory. /// The returned byte slice may represent uninitialized memory.
unsafe fn mut_bytes<'a>(&'a mut self) -> &'a mut [u8]; unsafe fn mut_bytes(&mut self) -> &mut [u8];
fn copy_from<S: Source>(&mut self, src: S) -> usize fn copy_from<S: Source>(&mut self, src: S) -> usize
where Self: Sized { where Self: Sized {
@@ -617,7 +617,7 @@ impl<T: AsMut<[u8]> + AsRef<[u8]>> MutBuf for io::Cursor<T> {
/// length between 0 and `MutBuf::remaining()`. /// length between 0 and `MutBuf::remaining()`.
/// ///
/// The returned byte slice may represent uninitialized memory. /// The returned byte slice may represent uninitialized memory.
unsafe fn mut_bytes<'a>(&'a mut self) -> &'a mut [u8] { unsafe fn mut_bytes(&mut self) -> &mut [u8] {
let pos = self.position() as usize; let pos = self.position() as usize;
&mut (self.get_mut().as_mut())[pos..] &mut (self.get_mut().as_mut())[pos..]
} }
+2 -2
View File
@@ -41,7 +41,7 @@ impl<T: Buf> Buf for Take<T> {
cmp::min(self.inner.remaining(), self.limit) cmp::min(self.inner.remaining(), self.limit)
} }
fn bytes<'a>(&'a self) -> &'a [u8] { fn bytes(&self) -> &[u8] {
&self.inner.bytes()[..self.limit] &self.inner.bytes()[..self.limit]
} }
@@ -57,7 +57,7 @@ impl<T: MutBuf> MutBuf for Take<T> {
cmp::min(self.inner.remaining(), self.limit) cmp::min(self.inner.remaining(), self.limit)
} }
unsafe fn mut_bytes<'a>(&'a mut self) -> &'a mut [u8] { unsafe fn mut_bytes(&mut self) -> &mut [u8] {
&mut self.inner.mut_bytes()[..self.limit] &mut self.inner.mut_bytes()[..self.limit]
} }
+2
View File
@@ -14,6 +14,8 @@ pub use imp::buf::{Buf, MutBuf};
pub use imp::bytes::Bytes; pub use imp::bytes::Bytes;
pub mod buf { pub mod buf {
//! Traits, helpers, and type definitions for working with buffers.
pub use imp::buf::{ pub use imp::buf::{
Source, Source,
Sink, Sink,