From 144ebbba1dc7f7c2b5fa6b40609342b1a248112b Mon Sep 17 00:00:00 2001 From: Garen Tyler Date: Tue, 19 Apr 2022 08:27:22 -0600 Subject: [PATCH] clippy --- src/mctypes/numbers.rs | 2 +- src/net/mod.rs | 4 ++-- src/net/packets.rs | 4 ++-- src/server/mod.rs | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/mctypes/numbers.rs b/src/mctypes/numbers.rs index be72a62..330f164 100644 --- a/src/mctypes/numbers.rs +++ b/src/mctypes/numbers.rs @@ -60,7 +60,7 @@ pub fn parse_varint(data: &[u8]) -> ParseResult { return Err(ParseError::NotEnoughData); } - output |= (((data[offset] & 0x7f) as i32) << bytes_read * 7) as i32; + output |= (((data[offset] & 0x7f) as i32) << (bytes_read * 7)) as i32; bytes_read += 1; if data[offset] & 0x80 != 0x80 { break; diff --git a/src/net/mod.rs b/src/net/mod.rs index 126c03b..95cbd48 100644 --- a/src/net/mod.rs +++ b/src/net/mod.rs @@ -2,7 +2,7 @@ pub mod packets; use crate::prelude::*; pub use packets::Packet; -use std::time::{Duration, Instant}; +use std::time::Instant; use tokio::net::TcpStream; #[derive(PartialEq, Copy, Clone, Debug)] @@ -49,7 +49,7 @@ impl NetworkClient { } Err(ref e) if e.kind() == tokio::io::ErrorKind::WouldBlock => break, Err(e) => { - return Err(e.into()); + return Err(e); } } } diff --git a/src/net/packets.rs b/src/net/packets.rs index bbb52e8..ab8db5b 100644 --- a/src/net/packets.rs +++ b/src/net/packets.rs @@ -32,7 +32,7 @@ pub enum Packet { impl Packet { pub fn parse_body( data: &[u8], - length: usize, + _length: usize, id: usize, state: NetworkClientState, serverbound: bool, @@ -119,7 +119,7 @@ impl Packet { "favicon": format!("data:image/png;base64,{}", radix64::STD_NO_PAD.encode(FAVICON.as_ref().unwrap())), })), ), - CS01Pong { payload } => (0x01, serialize_long(payload.clone()).to_vec()), + CS01Pong { payload } => (0x01, serialize_long(*payload).to_vec()), _ => unimplemented!(), }; let mut id_and_body = serialize_varint(id as i32); diff --git a/src/server/mod.rs b/src/server/mod.rs index 228b454..fcc06f5 100644 --- a/src/server/mod.rs +++ b/src/server/mod.rs @@ -66,7 +66,7 @@ impl Server { match client.read_packet() { Ok(_) => {} Err(ParseError::NotEnoughData) => break 'packet, - Err(e) => {} + Err(_) => {} } } }