Skip to content

Commit

Permalink
Fix clippy (#285)
Browse files Browse the repository at this point in the history
  • Loading branch information
Douman authored and carllerche committed Aug 27, 2019
1 parent ae9991f commit 4f5ed82
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 18 deletions.
File renamed without changes.
4 changes: 2 additions & 2 deletions src/buf/chain.rs
Expand Up @@ -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,
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/buf/iter.rs
Expand Up @@ -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.
///
Expand Down
4 changes: 2 additions & 2 deletions src/buf/mod.rs
Expand Up @@ -16,7 +16,7 @@
//! [`Buf`]: trait.Buf.html
//! [`BufMut`]: trait.BufMut.html

mod buf;
mod buf_impl;
mod buf_mut;
mod chain;
mod iter;
Expand All @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/buf/reader.rs
Expand Up @@ -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> {
Expand Down
4 changes: 2 additions & 2 deletions src/buf/take.rs
Expand Up @@ -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,
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/buf/writer.rs
Expand Up @@ -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> {
Expand Down
18 changes: 9 additions & 9 deletions src/bytes.rs
Expand Up @@ -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
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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(),
}
Expand All @@ -1844,9 +1844,9 @@ impl Inner {

Inner {
arc: AtomicPtr::new(arc as *mut Shared),
ptr: ptr,
len: len,
cap: cap,
ptr,
len,
cap,
}
}

Expand Down Expand Up @@ -1987,7 +1987,7 @@ impl Inner {
self.set_end(at);
}

return other
other
}

fn split_to(&mut self, at: usize) -> Inner {
Expand All @@ -1998,7 +1998,7 @@ impl Inner {
self.set_start(at);
}

return other
other
}

fn truncate(&mut self, len: usize) {
Expand Down Expand Up @@ -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`.
Expand Down

0 comments on commit 4f5ed82

Please sign in to comment.