From ca70e5e321a3c174c53d0650feed84db471ac30d Mon Sep 17 00:00:00 2001 From: mat Date: Thu, 11 Dec 2025 23:21:42 -1030 Subject: enable str_to_string clippy lint --- azalea-protocol/src/address.rs | 2 +- azalea-protocol/src/common/client_information.rs | 6 +++--- azalea-protocol/src/connect.rs | 2 +- azalea-protocol/src/lib.rs | 4 ++-- azalea-protocol/src/packets/game/c_command_suggestions.rs | 2 +- azalea-protocol/src/packets/game/c_commands.rs | 4 ++-- azalea-protocol/src/packets/game/c_disguised_chat.rs | 2 +- azalea-protocol/src/packets/game/c_player_chat.rs | 2 +- azalea-protocol/src/packets/game/c_system_chat.rs | 6 +++--- azalea-protocol/src/packets/game/c_update_advancements.rs | 8 ++++---- azalea-protocol/src/packets/game/s_set_jigsaw_block.rs | 4 ++-- azalea-protocol/src/packets/login/s_hello.rs | 2 +- 12 files changed, 22 insertions(+), 22 deletions(-) (limited to 'azalea-protocol') diff --git a/azalea-protocol/src/address.rs b/azalea-protocol/src/address.rs index a3e487a1..569e2488 100644 --- a/azalea-protocol/src/address.rs +++ b/azalea-protocol/src/address.rs @@ -75,7 +75,7 @@ impl TryFrom<&str> for ServerAddr { return Err(ServerAddrParseError); } let mut parts = string.split(':'); - let host = parts.next().ok_or(ServerAddrParseError)?.to_string(); + let host = parts.next().ok_or(ServerAddrParseError)?.to_owned(); // default the port to 25565 let port = parts.next().unwrap_or("25565"); let port = u16::from_str(port).ok().ok_or(ServerAddrParseError)?; diff --git a/azalea-protocol/src/common/client_information.rs b/azalea-protocol/src/common/client_information.rs index c5dd83d7..c5024a52 100644 --- a/azalea-protocol/src/common/client_information.rs +++ b/azalea-protocol/src/common/client_information.rs @@ -11,7 +11,7 @@ use bevy_ecs::component::Component; /// This is only present on local players. #[derive(Clone, Debug, AzBuf, PartialEq, Eq, Component)] pub struct ClientInformation { - /// The locale of the client. + /// The locale of the client, formatted like "en_us". pub language: String, /// The view distance of the client in chunks, same as the render distance /// in-game. @@ -36,7 +36,7 @@ pub struct ClientInformation { impl Default for ClientInformation { fn default() -> Self { Self { - language: "en_us".to_string(), + language: "en_us".to_owned(), view_distance: 8, chat_visibility: ChatVisibility::default(), chat_colors: true, @@ -158,7 +158,7 @@ mod tests { } let data = ClientInformation { - language: "en_gb".to_string(), + language: "en_gb".to_owned(), view_distance: 24, chat_visibility: ChatVisibility::Hidden, chat_colors: false, diff --git a/azalea-protocol/src/connect.rs b/azalea-protocol/src/connect.rs index 85fc643e..e6a7142d 100644 --- a/azalea-protocol/src/connect.rs +++ b/azalea-protocol/src/connect.rs @@ -99,7 +99,7 @@ pub struct WriteConnection { /// /// // login /// conn.write(ServerboundHello { -/// name: "bot".to_string(), +/// name: "bot".to_owned(), /// profile_id: uuid::Uuid::nil(), /// }) /// .await?; diff --git a/azalea-protocol/src/lib.rs b/azalea-protocol/src/lib.rs index dfff7da7..dc170e06 100644 --- a/azalea-protocol/src/lib.rs +++ b/azalea-protocol/src/lib.rs @@ -40,7 +40,7 @@ mod tests { #[tokio::test] async fn test_hello_packet() { let packet = ServerboundHello { - name: "test".to_string(), + name: "test".to_owned(), profile_id: Uuid::nil(), }; let mut stream = Vec::new(); @@ -70,7 +70,7 @@ mod tests { #[tokio::test] async fn test_double_hello_packet() { let packet = ServerboundHello { - name: "test".to_string(), + name: "test".to_owned(), profile_id: Uuid::nil(), } .into_variant(); diff --git a/azalea-protocol/src/packets/game/c_command_suggestions.rs b/azalea-protocol/src/packets/game/c_command_suggestions.rs index 4512b9b3..eff953ee 100644 --- a/azalea-protocol/src/packets/game/c_command_suggestions.rs +++ b/azalea-protocol/src/packets/game/c_command_suggestions.rs @@ -25,7 +25,7 @@ mod tests { vec![Suggestion::new_with_tooltip( StringRange::new(1, 4), "foo", - "bar".to_string(), + "bar".to_owned(), )], ); let mut buf = Vec::new(); diff --git a/azalea-protocol/src/packets/game/c_commands.rs b/azalea-protocol/src/packets/game/c_commands.rs index f96e7ef0..758c8f27 100644 --- a/azalea-protocol/src/packets/game/c_commands.rs +++ b/azalea-protocol/src/packets/game/c_commands.rs @@ -360,7 +360,7 @@ mod tests { children: vec![], redirect_node: None, node_type: NodeType::Literal { - name: "String".to_string(), + name: "String".to_owned(), }, is_restricted: false, }; @@ -378,7 +378,7 @@ mod tests { children: vec![6, 9], redirect_node: Some(5), node_type: NodeType::Argument { - name: "position".to_string(), + name: "position".to_owned(), parser: BrigadierParser::Vec3, suggestions_type: Some(Identifier::new("minecraft:test_suggestion")), }, diff --git a/azalea-protocol/src/packets/game/c_disguised_chat.rs b/azalea-protocol/src/packets/game/c_disguised_chat.rs index 1b7505c6..31cdc0c6 100644 --- a/azalea-protocol/src/packets/game/c_disguised_chat.rs +++ b/azalea-protocol/src/packets/game/c_disguised_chat.rs @@ -50,7 +50,7 @@ impl ClientboundDisguisedChat { } let translation_key = self.chat_type.translation_key(registries); - let component = TranslatableComponent::new(translation_key.to_string(), args); + let component = TranslatableComponent::new(translation_key.to_owned(), args); FormattedText::Translatable(component) } diff --git a/azalea-protocol/src/packets/game/c_player_chat.rs b/azalea-protocol/src/packets/game/c_player_chat.rs index 3904d0d9..41e457a2 100644 --- a/azalea-protocol/src/packets/game/c_player_chat.rs +++ b/azalea-protocol/src/packets/game/c_player_chat.rs @@ -162,7 +162,7 @@ impl ClientboundPlayerChat { // TODO: implement chat type registry and apply the styles from it here let translation_key = self.chat_type.translation_key(registries); - let component = TranslatableComponent::new(translation_key.to_string(), args); + let component = TranslatableComponent::new(translation_key.to_owned(), args); FormattedText::Translatable(component) } diff --git a/azalea-protocol/src/packets/game/c_system_chat.rs b/azalea-protocol/src/packets/game/c_system_chat.rs index c57c0df0..6ad67ccd 100644 --- a/azalea-protocol/src/packets/game/c_system_chat.rs +++ b/azalea-protocol/src/packets/game/c_system_chat.rs @@ -26,7 +26,7 @@ mod tests { let packet = ClientboundSystemChat::azalea_read(&mut Cursor::new(&bytes)).unwrap(); assert_eq!( packet.content.to_string(), - "[py5: Gave 1 [Diamond Pickaxe] to py5]".to_string() + "[py5: Gave 1 [Diamond Pickaxe] to py5]".to_owned() ); } @@ -39,7 +39,7 @@ mod tests { let packet = ClientboundSystemChat::azalea_read(&mut Cursor::new(&bytes)).unwrap(); assert_eq!( packet.content.to_string(), - "Displaying particle minecraft:dust".to_string() + "Displaying particle minecraft:dust".to_owned() ); } @@ -53,7 +53,7 @@ mod tests { assert_eq!( packet.content.to_string().trim(), - "Position in queue: 328\nYou can purchase priority queue status to join the server faster, visit shop.2b2t.org".to_string() + "Position in queue: 328\nYou can purchase priority queue status to join the server faster, visit shop.2b2t.org".to_owned() ); } diff --git a/azalea-protocol/src/packets/game/c_update_advancements.rs b/azalea-protocol/src/packets/game/c_update_advancements.rs index bba53998..6f3e960e 100644 --- a/azalea-protocol/src/packets/game/c_update_advancements.rs +++ b/azalea-protocol/src/packets/game/c_update_advancements.rs @@ -5,9 +5,9 @@ use std::{ use azalea_buf::AzBuf; use azalea_chat::FormattedText; -use azalea_registry::identifier::Identifier; use azalea_inventory::ItemStack; use azalea_protocol_macros::ClientboundGamePacket; +use azalea_registry::identifier::Identifier; use indexmap::IndexMap; #[derive(Clone, Debug, AzBuf, PartialEq, ClientboundGamePacket)] @@ -135,8 +135,8 @@ mod tests { value: Advancement { parent_id: None, display: Some(DisplayInfo { - title: FormattedText::from("title".to_string()), - description: FormattedText::from("description".to_string()), + title: FormattedText::from("title".to_owned()), + description: FormattedText::from("description".to_owned()), icon: ItemStack::Empty, frame: FrameType::Task, show_toast: true, @@ -155,7 +155,7 @@ mod tests { progress: [( Identifier::new("minecraft:test3"), [( - "minecraft:test4".to_string(), + "minecraft:test4".to_owned(), CriterionProgress { date: Some(123456789), }, diff --git a/azalea-protocol/src/packets/game/s_set_jigsaw_block.rs b/azalea-protocol/src/packets/game/s_set_jigsaw_block.rs index 2203d3e9..64a46c02 100644 --- a/azalea-protocol/src/packets/game/s_set_jigsaw_block.rs +++ b/azalea-protocol/src/packets/game/s_set_jigsaw_block.rs @@ -43,8 +43,8 @@ impl AzaleaRead for JointType { impl AzaleaWrite for JointType { fn azalea_write(&self, buf: &mut impl Write) -> io::Result<()> { match self { - JointType::Rollable => "rollable".to_string().azalea_write(buf)?, - JointType::Aligned => "aligned".to_string().azalea_write(buf)?, + JointType::Rollable => "rollable".to_owned().azalea_write(buf)?, + JointType::Aligned => "aligned".to_owned().azalea_write(buf)?, }; Ok(()) } diff --git a/azalea-protocol/src/packets/login/s_hello.rs b/azalea-protocol/src/packets/login/s_hello.rs index 86fc9f49..a65fe6a1 100644 --- a/azalea-protocol/src/packets/login/s_hello.rs +++ b/azalea-protocol/src/packets/login/s_hello.rs @@ -20,7 +20,7 @@ mod tests { #[test] fn test_read_write() { let packet = ServerboundHello { - name: "test".to_string(), + name: "test".to_owned(), profile_id: Uuid::nil(), }; let mut buf: Vec = Vec::new(); -- cgit v1.2.3