clippy
This commit is contained in:
parent
9b760eb58f
commit
144ebbba1d
@ -60,7 +60,7 @@ pub fn parse_varint(data: &[u8]) -> ParseResult<i32> {
|
||||
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;
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -66,7 +66,7 @@ impl Server {
|
||||
match client.read_packet() {
|
||||
Ok(_) => {}
|
||||
Err(ParseError::NotEnoughData) => break 'packet,
|
||||
Err(e) => {}
|
||||
Err(_) => {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user