Resolve clippy warnings

This commit is contained in:
timvisee 2021-11-25 13:39:52 +01:00
parent 084c3c5f8b
commit e7d2c6f64c
No known key found for this signature in database
GPG Key ID: B8DB720BC383E172
6 changed files with 11 additions and 11 deletions

View File

@ -83,7 +83,7 @@ pub async fn respond_login_plugin_request(
) -> Result<(), ()> { ) -> Result<(), ()> {
// Decode Forge login wrapper packet // Decode Forge login wrapper packet
let (message_id, login_wrapper, packet) = let (message_id, login_wrapper, packet) =
forge::decode_forge_login_packet(&client, packet).await?; forge::decode_forge_login_packet(client, packet).await?;
// Determine whether we received the mod list // Determine whether we received the mod list
let is_unknown_header = login_wrapper.channel != forge::CHANNEL_HANDSHAKE; let is_unknown_header = login_wrapper.channel != forge::CHANNEL_HANDSHAKE;
@ -166,7 +166,7 @@ pub async fn replay_login_payload(
// Replay each Forge packet // Replay each Forge packet
for packet in server.forge_payload.lock().await.as_slice() { for packet in server.forge_payload.lock().await.as_slice() {
inbound.write_all(&packet).await.map_err(|err| { inbound.write_all(packet).await.map_err(|err| {
error!(target: "lazymc::lobby", "Failed to send Forge join payload to lobby client, will likely cause issues: {}", err); error!(target: "lazymc::lobby", "Failed to send Forge join payload to lobby client, will likely cause issues: {}", err);
})?; })?;
} }
@ -198,7 +198,7 @@ async fn drain_forge_responses(
} }
// TODO: move timeout into constant // TODO: move timeout into constant
let read_packet_task = packet::read_packet(&client, buf, &mut reader); let read_packet_task = packet::read_packet(client, buf, &mut reader);
let timeout = time::timeout(Duration::from_secs(5), read_packet_task).await; let timeout = time::timeout(Duration::from_secs(5), read_packet_task).await;
let read_packet_task = match timeout { let read_packet_task = match timeout {

View File

@ -102,7 +102,7 @@ fn snbt_to_compound_tag(data: &str) -> CompoundTag {
.expect("failed to encode NBT CompoundTag as binary"); .expect("failed to encode NBT CompoundTag as binary");
// Parse binary with usable NBT create // Parse binary with usable NBT create
bin_to_compound_tag(&mut &*binary) bin_to_compound_tag(&binary)
} }
/// Read NBT CompoundTag from SNBT. /// Read NBT CompoundTag from SNBT.

View File

@ -53,7 +53,7 @@ pub async fn probe(config: Arc<Config>, server: Arc<Server>) -> Result<(), ()> {
// Connect to server, record Forge payload // Connect to server, record Forge payload
let forge_payload = connect_to_server(&config, &server).await?; let forge_payload = connect_to_server(&config, &server).await?;
*server.forge_payload.lock().await = forge_payload.into(); *server.forge_payload.lock().await = forge_payload;
Ok(()) Ok(())
} }

View File

@ -89,11 +89,11 @@ pub async fn lobby_send(
) -> Result<(), ()> { ) -> Result<(), ()> {
// Get dimension codec and build lobby dimension // Get dimension codec and build lobby dimension
let dimension_codec: CompoundTag = let dimension_codec: CompoundTag =
if let Some(ref join_game) = server.probed_join_game.lock().await.as_ref() { if let Some(join_game) = server.probed_join_game.lock().await.as_ref() {
join_game join_game
.dimension_codec .dimension_codec
.clone() .clone()
.unwrap_or_else(|| dimension::default_dimension_codec()) .unwrap_or_else(dimension::default_dimension_codec)
} else { } else {
dimension::default_dimension_codec() dimension::default_dimension_codec()
}; };

View File

@ -23,7 +23,7 @@ pub async fn lobby_send(
dimension::lobby_dimension( dimension::lobby_dimension(
&data &data
.dimension_codec .dimension_codec
.unwrap_or_else(|| dimension::default_dimension_codec()), .unwrap_or_else(dimension::default_dimension_codec),
) )
}), }),
world_name: data.world_name.unwrap_or_else(|| "world".into()), world_name: data.world_name.unwrap_or_else(|| "world".into()),
@ -46,7 +46,7 @@ pub async fn lobby_send(
dimension::lobby_dimension( dimension::lobby_dimension(
&data &data
.dimension_codec .dimension_codec
.unwrap_or_else(|| dimension::default_dimension_codec()), .unwrap_or_else(dimension::default_dimension_codec),
) )
}), }),
world_name: data.world_name.unwrap_or_else(|| "world".into()), world_name: data.world_name.unwrap_or_else(|| "world".into()),

View File

@ -58,7 +58,7 @@ async fn send_v1_16_3(
packet::write_packet( packet::write_packet(
Title { Title {
action: TitleAction::SetSubtitle { action: TitleAction::SetSubtitle {
text: Message::new(Payload::text(&subtitle)), text: Message::new(Payload::text(subtitle)),
}, },
}, },
client, client,
@ -111,7 +111,7 @@ async fn send_v1_17(
// Set subtitle // Set subtitle
packet::write_packet( packet::write_packet(
SetTitleSubtitle { SetTitleSubtitle {
text: Message::new(Payload::text(&subtitle)), text: Message::new(Payload::text(subtitle)),
}, },
client, client,
writer, writer,