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);
|
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;
|
bytes_read += 1;
|
||||||
if data[offset] & 0x80 != 0x80 {
|
if data[offset] & 0x80 != 0x80 {
|
||||||
break;
|
break;
|
||||||
|
@ -2,7 +2,7 @@ pub mod packets;
|
|||||||
|
|
||||||
use crate::prelude::*;
|
use crate::prelude::*;
|
||||||
pub use packets::Packet;
|
pub use packets::Packet;
|
||||||
use std::time::{Duration, Instant};
|
use std::time::Instant;
|
||||||
use tokio::net::TcpStream;
|
use tokio::net::TcpStream;
|
||||||
|
|
||||||
#[derive(PartialEq, Copy, Clone, Debug)]
|
#[derive(PartialEq, Copy, Clone, Debug)]
|
||||||
@ -49,7 +49,7 @@ impl NetworkClient {
|
|||||||
}
|
}
|
||||||
Err(ref e) if e.kind() == tokio::io::ErrorKind::WouldBlock => break,
|
Err(ref e) if e.kind() == tokio::io::ErrorKind::WouldBlock => break,
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
return Err(e.into());
|
return Err(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,7 @@ pub enum Packet {
|
|||||||
impl Packet {
|
impl Packet {
|
||||||
pub fn parse_body(
|
pub fn parse_body(
|
||||||
data: &[u8],
|
data: &[u8],
|
||||||
length: usize,
|
_length: usize,
|
||||||
id: usize,
|
id: usize,
|
||||||
state: NetworkClientState,
|
state: NetworkClientState,
|
||||||
serverbound: bool,
|
serverbound: bool,
|
||||||
@ -119,7 +119,7 @@ impl Packet {
|
|||||||
"favicon": format!("data:image/png;base64,{}", radix64::STD_NO_PAD.encode(FAVICON.as_ref().unwrap())),
|
"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!(),
|
_ => unimplemented!(),
|
||||||
};
|
};
|
||||||
let mut id_and_body = serialize_varint(id as i32);
|
let mut id_and_body = serialize_varint(id as i32);
|
||||||
|
@ -66,7 +66,7 @@ impl Server {
|
|||||||
match client.read_packet() {
|
match client.read_packet() {
|
||||||
Ok(_) => {}
|
Ok(_) => {}
|
||||||
Err(ParseError::NotEnoughData) => break 'packet,
|
Err(ParseError::NotEnoughData) => break 'packet,
|
||||||
Err(e) => {}
|
Err(_) => {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user