mirror of
https://github.com/tribufu/rust-gamedig
synced 2026-06-01 09:42:41 +00:00
[Protocol] Apply many nursery clippy lints
This commit is contained in:
parent
c4097fae78
commit
f50c50f0f1
21 changed files with 166 additions and 178 deletions
|
|
@ -56,8 +56,8 @@ impl CommonResponse for Response {
|
|||
}
|
||||
}
|
||||
|
||||
fn parse_players_and_teams(packet: Vec<u8>) -> GDResult<Vec<Player>> {
|
||||
let mut buf = Buffer::<BigEndian>::new(&packet);
|
||||
fn parse_players_and_teams(packet: &[u8]) -> GDResult<Vec<Player>> {
|
||||
let mut buf = Buffer::<BigEndian>::new(packet);
|
||||
|
||||
let count = buf.read::<u16>()?;
|
||||
let mut players = Vec::with_capacity(count as usize);
|
||||
|
|
@ -67,7 +67,7 @@ fn parse_players_and_teams(packet: Vec<u8>) -> GDResult<Vec<Player>> {
|
|||
name: buf.read_string::<Utf8Decoder>(None)?,
|
||||
steam_id: buf.read_string::<Utf8Decoder>(None)?,
|
||||
ping: buf.read::<u16>()?,
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
Ok(players)
|
||||
|
|
@ -93,7 +93,7 @@ pub fn query_with_timeout(
|
|||
.ok_or(PacketBad.context("First packet missing"))?;
|
||||
|
||||
let (mut server_vars, remaining_data) = data_to_map(data)?;
|
||||
let players = parse_players_and_teams(remaining_data)?;
|
||||
let players = parse_players_and_teams(&remaining_data)?;
|
||||
|
||||
let players_maximum = server_vars
|
||||
.remove("maxplayers")
|
||||
|
|
|
|||
|
|
@ -123,7 +123,7 @@ use std::net::{IpAddr, SocketAddr};
|
|||
|
||||
/// Definition of a game
|
||||
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
pub struct Game {
|
||||
/// Full name of the game
|
||||
pub name: &'static str,
|
||||
|
|
|
|||
|
|
@ -29,8 +29,8 @@ impl TheShipPlayer {
|
|||
name: player.name.clone(),
|
||||
score: player.score,
|
||||
duration: player.duration,
|
||||
deaths: player.deaths.unwrap(),
|
||||
money: player.money.unwrap(),
|
||||
deaths: player.deaths.unwrap(), // TODO! Err here!
|
||||
money: player.money.unwrap(), // TODO! Err here!
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -93,7 +93,7 @@ impl Response {
|
|||
pub fn new_from_valve_response(response: valve::Response) -> Self {
|
||||
let (port, steam_id, tv_port, tv_name, keywords) = get_optional_extracted_data(response.info.extra_data);
|
||||
|
||||
let the_unwrapped_ship = response.info.the_ship.unwrap();
|
||||
let the_unwrapped_ship = response.info.the_ship.unwrap(); // TODO! Err here!
|
||||
|
||||
Self {
|
||||
protocol_version: response.info.protocol_version,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue