mirror of
https://github.com/tokio-rs/bytes.git
synced 2026-08-25 00:00:22 +02:00
Fix clippy (#285)
This commit is contained in:
+2
-2
@@ -50,8 +50,8 @@ impl<T, U> Chain<T, U> {
|
|||||||
/// ```
|
/// ```
|
||||||
pub fn new(a: T, b: U) -> Chain<T, U> {
|
pub fn new(a: T, b: U) -> Chain<T, U> {
|
||||||
Chain {
|
Chain {
|
||||||
a: a,
|
a,
|
||||||
b: b,
|
b,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -45,7 +45,7 @@ impl<T> IntoIter<T> {
|
|||||||
/// assert_eq!(iter.next(), None);
|
/// assert_eq!(iter.next(), None);
|
||||||
/// ```
|
/// ```
|
||||||
pub fn new(inner: T) -> IntoIter<T> {
|
pub fn new(inner: T) -> IntoIter<T> {
|
||||||
IntoIter { inner: inner }
|
IntoIter { inner }
|
||||||
}
|
}
|
||||||
/// Consumes this `IntoIter`, returning the underlying value.
|
/// Consumes this `IntoIter`, returning the underlying value.
|
||||||
///
|
///
|
||||||
|
|||||||
+2
-2
@@ -16,7 +16,7 @@
|
|||||||
//! [`Buf`]: trait.Buf.html
|
//! [`Buf`]: trait.Buf.html
|
||||||
//! [`BufMut`]: trait.BufMut.html
|
//! [`BufMut`]: trait.BufMut.html
|
||||||
|
|
||||||
mod buf;
|
mod buf_impl;
|
||||||
mod buf_mut;
|
mod buf_mut;
|
||||||
mod chain;
|
mod chain;
|
||||||
mod iter;
|
mod iter;
|
||||||
@@ -25,7 +25,7 @@ mod take;
|
|||||||
mod vec_deque;
|
mod vec_deque;
|
||||||
mod writer;
|
mod writer;
|
||||||
|
|
||||||
pub use self::buf::Buf;
|
pub use self::buf_impl::Buf;
|
||||||
pub use self::buf_mut::BufMut;
|
pub use self::buf_mut::BufMut;
|
||||||
pub use self::chain::Chain;
|
pub use self::chain::Chain;
|
||||||
pub use self::iter::IntoIter;
|
pub use self::iter::IntoIter;
|
||||||
|
|||||||
+1
-1
@@ -13,7 +13,7 @@ pub struct Reader<B> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn new<B>(buf: B) -> Reader<B> {
|
pub fn new<B>(buf: B) -> Reader<B> {
|
||||||
Reader { buf: buf }
|
Reader { buf }
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<B: Buf> Reader<B> {
|
impl<B: Buf> Reader<B> {
|
||||||
|
|||||||
+2
-2
@@ -14,8 +14,8 @@ pub struct Take<T> {
|
|||||||
|
|
||||||
pub fn new<T>(inner: T, limit: usize) -> Take<T> {
|
pub fn new<T>(inner: T, limit: usize) -> Take<T> {
|
||||||
Take {
|
Take {
|
||||||
inner: inner,
|
inner,
|
||||||
limit: limit,
|
limit,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -13,7 +13,7 @@ pub struct Writer<B> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn new<B>(buf: B) -> Writer<B> {
|
pub fn new<B>(buf: B) -> Writer<B> {
|
||||||
Writer { buf: buf }
|
Writer { buf }
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<B: BufMut> Writer<B> {
|
impl<B: BufMut> Writer<B> {
|
||||||
|
|||||||
+9
-9
@@ -357,7 +357,7 @@ const MAX_VEC_POS: usize = usize::MAX >> VEC_POS_OFFSET;
|
|||||||
const NOT_VEC_POS_MASK: usize = 0b11111;
|
const NOT_VEC_POS_MASK: usize = 0b11111;
|
||||||
|
|
||||||
// Bit op constants for extracting the inline length value from the `arc` field.
|
// Bit op constants for extracting the inline length value from the `arc` field.
|
||||||
const INLINE_LEN_MASK: usize = 0b11111100;
|
const INLINE_LEN_MASK: usize = 0b1111_1100;
|
||||||
const INLINE_LEN_OFFSET: usize = 2;
|
const INLINE_LEN_OFFSET: usize = 2;
|
||||||
|
|
||||||
// Byte offset from the start of `Inner` to where the inline buffer data
|
// Byte offset from the start of `Inner` to where the inline buffer data
|
||||||
@@ -1671,7 +1671,7 @@ impl<'a> From<&'a [u8]> for BytesMut {
|
|||||||
inner.as_raw()[0..len].copy_from_slice(src);
|
inner.as_raw()[0..len].copy_from_slice(src);
|
||||||
|
|
||||||
BytesMut {
|
BytesMut {
|
||||||
inner: inner,
|
inner,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -1825,7 +1825,7 @@ impl Inner {
|
|||||||
// track the fact that the `Bytes` handle is backed by a
|
// track the fact that the `Bytes` handle is backed by a
|
||||||
// static buffer.
|
// static buffer.
|
||||||
arc: AtomicPtr::new(KIND_STATIC as *mut Shared),
|
arc: AtomicPtr::new(KIND_STATIC as *mut Shared),
|
||||||
ptr: ptr,
|
ptr,
|
||||||
len: bytes.len(),
|
len: bytes.len(),
|
||||||
cap: bytes.len(),
|
cap: bytes.len(),
|
||||||
}
|
}
|
||||||
@@ -1844,9 +1844,9 @@ impl Inner {
|
|||||||
|
|
||||||
Inner {
|
Inner {
|
||||||
arc: AtomicPtr::new(arc as *mut Shared),
|
arc: AtomicPtr::new(arc as *mut Shared),
|
||||||
ptr: ptr,
|
ptr,
|
||||||
len: len,
|
len,
|
||||||
cap: cap,
|
cap,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1987,7 +1987,7 @@ impl Inner {
|
|||||||
self.set_end(at);
|
self.set_end(at);
|
||||||
}
|
}
|
||||||
|
|
||||||
return other
|
other
|
||||||
}
|
}
|
||||||
|
|
||||||
fn split_to(&mut self, at: usize) -> Inner {
|
fn split_to(&mut self, at: usize) -> Inner {
|
||||||
@@ -1998,7 +1998,7 @@ impl Inner {
|
|||||||
self.set_start(at);
|
self.set_start(at);
|
||||||
}
|
}
|
||||||
|
|
||||||
return other
|
other
|
||||||
}
|
}
|
||||||
|
|
||||||
fn truncate(&mut self, len: usize) {
|
fn truncate(&mut self, len: usize) {
|
||||||
@@ -2246,7 +2246,7 @@ impl Inner {
|
|||||||
// vector.
|
// vector.
|
||||||
let shared = Box::new(Shared {
|
let shared = Box::new(Shared {
|
||||||
vec: rebuild_vec(self.ptr, self.len, self.cap, off),
|
vec: rebuild_vec(self.ptr, self.len, self.cap, off),
|
||||||
original_capacity_repr: original_capacity_repr,
|
original_capacity_repr,
|
||||||
// Initialize refcount to 2. One for this reference, and one
|
// Initialize refcount to 2. One for this reference, and one
|
||||||
// for the new clone that will be returned from
|
// for the new clone that will be returned from
|
||||||
// `shallow_clone`.
|
// `shallow_clone`.
|
||||||
|
|||||||
Reference in New Issue
Block a user