Fix clippy (#285)

This commit is contained in:
Douman
2019-08-27 23:19:44 +02:00
committed by Carl Lerche
parent e7fe763e95
commit def58d121a
8 changed files with 18 additions and 18 deletions
+2 -2
View File
@@ -50,8 +50,8 @@ impl<T, U> Chain<T, U> {
/// ```
pub fn new(a: T, b: U) -> Chain<T, U> {
Chain {
a: a,
b: b,
a,
b,
}
}
+1 -1
View File
@@ -45,7 +45,7 @@ impl<T> IntoIter<T> {
/// assert_eq!(iter.next(), None);
/// ```
pub fn new(inner: T) -> IntoIter<T> {
IntoIter { inner: inner }
IntoIter { inner }
}
/// Consumes this `IntoIter`, returning the underlying value.
///
+2 -2
View File
@@ -16,7 +16,7 @@
//! [`Buf`]: trait.Buf.html
//! [`BufMut`]: trait.BufMut.html
mod buf;
mod buf_impl;
mod buf_mut;
mod chain;
mod iter;
@@ -25,7 +25,7 @@ mod take;
mod vec_deque;
mod writer;
pub use self::buf::Buf;
pub use self::buf_impl::Buf;
pub use self::buf_mut::BufMut;
pub use self::chain::Chain;
pub use self::iter::IntoIter;
+1 -1
View File
@@ -13,7 +13,7 @@ pub struct Reader<B> {
}
pub fn new<B>(buf: B) -> Reader<B> {
Reader { buf: buf }
Reader { buf }
}
impl<B: Buf> Reader<B> {
+2 -2
View File
@@ -14,8 +14,8 @@ pub struct Take<T> {
pub fn new<T>(inner: T, limit: usize) -> Take<T> {
Take {
inner: inner,
limit: limit,
inner,
limit,
}
}
+1 -1
View File
@@ -13,7 +13,7 @@ pub struct Writer<B> {
}
pub fn new<B>(buf: B) -> Writer<B> {
Writer { buf: buf }
Writer { buf }
}
impl<B: BufMut> Writer<B> {
+9 -9
View File
@@ -357,7 +357,7 @@ const MAX_VEC_POS: usize = usize::MAX >> VEC_POS_OFFSET;
const NOT_VEC_POS_MASK: usize = 0b11111;
// 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;
// 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);
BytesMut {
inner: inner,
inner,
}
}
} else {
@@ -1825,7 +1825,7 @@ impl Inner {
// track the fact that the `Bytes` handle is backed by a
// static buffer.
arc: AtomicPtr::new(KIND_STATIC as *mut Shared),
ptr: ptr,
ptr,
len: bytes.len(),
cap: bytes.len(),
}
@@ -1844,9 +1844,9 @@ impl Inner {
Inner {
arc: AtomicPtr::new(arc as *mut Shared),
ptr: ptr,
len: len,
cap: cap,
ptr,
len,
cap,
}
}
@@ -1987,7 +1987,7 @@ impl Inner {
self.set_end(at);
}
return other
other
}
fn split_to(&mut self, at: usize) -> Inner {
@@ -1998,7 +1998,7 @@ impl Inner {
self.set_start(at);
}
return other
other
}
fn truncate(&mut self, len: usize) {
@@ -2246,7 +2246,7 @@ impl Inner {
// vector.
let shared = Box::new(Shared {
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
// for the new clone that will be returned from
// `shallow_clone`.