Skip to content

Commit 4f57046

Browse files
committed
Fix clippy warnings
1 parent 6120c78 commit 4f57046

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

src/reader.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ impl VarIntProcessor {
6868
#[async_trait::async_trait(?Send)]
6969
impl<AR: AsyncRead + Unpin> VarIntAsyncReader for AR {
7070
async fn read_varint_async<VI: VarInt>(&mut self) -> Result<VI> {
71-
let mut buf = [0 as u8; 1];
71+
let mut buf = [0_u8; 1];
7272
let mut p = VarIntProcessor::new::<VI>();
7373

7474
while !p.finished() {
@@ -92,7 +92,7 @@ impl<AR: AsyncRead + Unpin> VarIntAsyncReader for AR {
9292

9393
impl<R: Read> VarIntReader for R {
9494
fn read_varint<VI: VarInt>(&mut self) -> Result<VI> {
95-
let mut buf = [0 as u8; 1];
95+
let mut buf = [0_u8; 1];
9696
let mut p = VarIntProcessor::new::<VI>();
9797

9898
while !p.finished() {
@@ -133,7 +133,7 @@ pub trait FixedIntAsyncReader {
133133
#[async_trait::async_trait(?Send)]
134134
impl<AR: AsyncRead + Unpin> FixedIntAsyncReader for AR {
135135
async fn read_fixedint_async<FI: FixedInt>(&mut self) -> Result<FI> {
136-
let mut buf = [0 as u8; 8];
136+
let mut buf = [0_u8; 8];
137137
self.read_exact(&mut buf[0..std::mem::size_of::<FI>()])
138138
.await?;
139139
Ok(FI::decode_fixed(&buf[0..std::mem::size_of::<FI>()]).unwrap())
@@ -142,7 +142,7 @@ impl<AR: AsyncRead + Unpin> FixedIntAsyncReader for AR {
142142

143143
impl<R: Read> FixedIntReader for R {
144144
fn read_fixedint<FI: FixedInt>(&mut self) -> Result<FI> {
145-
let mut buf = [0 as u8; 8];
145+
let mut buf = [0_u8; 8];
146146
self.read_exact(&mut buf[0..std::mem::size_of::<FI>()])?;
147147
Ok(FI::decode_fixed(&buf[0..std::mem::size_of::<FI>()]).unwrap())
148148
}

src/varint.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ impl VarInt for u64 {
147147
}
148148

149149
if success {
150-
Some((result, shift / 7 as usize))
150+
Some((result, shift / 7))
151151
} else {
152152
None
153153
}
@@ -187,7 +187,7 @@ impl VarInt for i64 {
187187
#[inline]
188188
fn encode_var(self, dst: &mut [u8]) -> usize {
189189
assert!(dst.len() >= self.required_space());
190-
let mut n: u64 = zigzag_encode(self as i64);
190+
let mut n: u64 = zigzag_encode(self);
191191
let mut i = 0;
192192

193193
while n >= 0x80 {

src/writer.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ pub trait VarIntAsyncWriter {
2727
#[async_trait::async_trait(?Send)]
2828
impl<AW: AsyncWrite + Unpin> VarIntAsyncWriter for AW {
2929
async fn write_varint_async<VI: VarInt>(&mut self, n: VI) -> Result<usize> {
30-
let mut buf = [0 as u8; 10];
30+
let mut buf = [0_u8; 10];
3131
let b = n.encode_var(&mut buf);
3232
self.write_all(&buf[0..b]).await?;
3333
Ok(b)
@@ -36,7 +36,7 @@ impl<AW: AsyncWrite + Unpin> VarIntAsyncWriter for AW {
3636

3737
impl<Inner: Write> VarIntWriter for Inner {
3838
fn write_varint<VI: VarInt>(&mut self, n: VI) -> Result<usize> {
39-
let mut buf = [0 as u8; 10];
39+
let mut buf = [0_u8; 10];
4040
let used = n.encode_var(&mut buf[..]);
4141

4242
self.write_all(&buf[0..used])?;
@@ -59,7 +59,7 @@ pub trait FixedIntAsyncWriter {
5959
#[async_trait::async_trait(?Send)]
6060
impl<AW: AsyncWrite + Unpin> FixedIntAsyncWriter for AW {
6161
async fn write_fixedint_async<FI: FixedInt>(&mut self, n: FI) -> Result<usize> {
62-
let mut buf = [0 as u8; 8];
62+
let mut buf = [0_u8; 8];
6363
n.encode_fixed(&mut buf[..std::mem::size_of::<FI>()]);
6464
self.write_all(&buf[..std::mem::size_of::<FI>()]).await?;
6565
Ok(std::mem::size_of::<FI>())
@@ -68,7 +68,7 @@ impl<AW: AsyncWrite + Unpin> FixedIntAsyncWriter for AW {
6868

6969
impl<W: Write> FixedIntWriter for W {
7070
fn write_fixedint<FI: FixedInt>(&mut self, n: FI) -> Result<usize> {
71-
let mut buf = [0 as u8; 8];
71+
let mut buf = [0_u8; 8];
7272
n.encode_fixed(&mut buf[..std::mem::size_of::<FI>()]);
7373

7474
self.write_all(&buf[..std::mem::size_of::<FI>()])?;

0 commit comments

Comments
 (0)