aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormat <git@matdoes.dev>2025-12-11 23:21:42 -1030
committermat <git@matdoes.dev>2025-12-11 23:21:42 -1030
commitca70e5e321a3c174c53d0650feed84db471ac30d (patch)
tree43042fa40c2f3d7f30ea56e1ee84c59dcb13be66
parent918214e8ba4eae65daf5d2da17aa0022f2ae5212 (diff)
downloadazalea-drasl-ca70e5e321a3c174c53d0650feed84db471ac30d.tar.xz
enable str_to_string clippy lint
-rw-r--r--Cargo.toml2
-rw-r--r--azalea-auth/src/auth.rs4
-rw-r--r--azalea-auth/src/game_profile.rs8
-rw-r--r--azalea-brigadier/src/arguments/bool_argument_type.rs2
-rw-r--r--azalea-brigadier/src/arguments/double_argument_type.rs2
-rw-r--r--azalea-brigadier/src/arguments/float_argument_type.rs2
-rw-r--r--azalea-brigadier/src/arguments/integer_argument_type.rs2
-rw-r--r--azalea-brigadier/src/arguments/long_argument_type.rs2
-rw-r--r--azalea-brigadier/src/arguments/string_argument_type.rs6
-rw-r--r--azalea-brigadier/src/builder/literal_argument_builder.rs2
-rw-r--r--azalea-brigadier/src/builder/required_argument_builder.rs2
-rw-r--r--azalea-brigadier/src/command_dispatcher.rs6
-rw-r--r--azalea-brigadier/src/context/command_context_builder.rs4
-rw-r--r--azalea-brigadier/src/errors/command_syntax_error.rs2
-rw-r--r--azalea-brigadier/src/string_reader.rs12
-rw-r--r--azalea-brigadier/src/suggestion/mod.rs4
-rw-r--r--azalea-brigadier/src/suggestion/suggestions_builder.rs12
-rw-r--r--azalea-brigadier/src/tree/mod.rs2
-rw-r--r--azalea-brigadier/tests/command_dispatcher_test.rs2
-rw-r--r--azalea-brigadier/tests/string_reader_test.rs138
-rw-r--r--azalea-brigadier/tests/suggestion/suggestions_builder_test.rs2
-rw-r--r--azalea-buf/src/lib.rs8
-rw-r--r--azalea-buf/src/read.rs4
-rw-r--r--azalea-chat/src/component.rs40
-rw-r--r--azalea-chat/src/style.rs11
-rw-r--r--azalea-chat/src/text_component.rs14
-rw-r--r--azalea-chat/src/translatable_component.rs76
-rw-r--r--azalea-client/src/account.rs6
-rw-r--r--azalea-client/src/plugins/chat/mod.rs4
-rw-r--r--azalea-client/src/plugins/disconnect.rs2
-rw-r--r--azalea-client/src/plugins/task_pool.rs6
-rw-r--r--azalea-client/src/test_utils/simulation.rs5
-rw-r--r--azalea-core/src/difficulty.rs85
-rw-r--r--azalea-entity/src/metadata.rs2
-rw-r--r--azalea-protocol/src/address.rs2
-rw-r--r--azalea-protocol/src/common/client_information.rs6
-rw-r--r--azalea-protocol/src/connect.rs2
-rw-r--r--azalea-protocol/src/lib.rs4
-rw-r--r--azalea-protocol/src/packets/game/c_command_suggestions.rs2
-rw-r--r--azalea-protocol/src/packets/game/c_commands.rs4
-rw-r--r--azalea-protocol/src/packets/game/c_disguised_chat.rs2
-rw-r--r--azalea-protocol/src/packets/game/c_player_chat.rs2
-rw-r--r--azalea-protocol/src/packets/game/c_system_chat.rs6
-rw-r--r--azalea-protocol/src/packets/game/c_update_advancements.rs8
-rw-r--r--azalea-protocol/src/packets/game/s_set_jigsaw_block.rs4
-rw-r--r--azalea-protocol/src/packets/login/s_hello.rs2
-rw-r--r--azalea-world/src/palette/container.rs2
-rw-r--r--azalea/examples/testbot/commands/debug.rs2
-rw-r--r--azalea/examples/testbot/main.rs6
-rw-r--r--azalea/src/pathfinder/tests.rs2
50 files changed, 263 insertions, 274 deletions
diff --git a/Cargo.toml b/Cargo.toml
index 6905af91..6ed73601 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -111,6 +111,8 @@ azalea-registry = { path = "azalea-registry", version = "0.14.0" }
azalea-world = { path = "azalea-world", version = "0.14.0" }
[workspace.lints.clippy]
+# https://users.rust-lang.org/t/to-string-vs-to-owned-for-string-literals/1441
+str_to_string = "warn"
# --- Profile Settings ---
diff --git a/azalea-auth/src/auth.rs b/azalea-auth/src/auth.rs
index a4176d6c..779910d3 100644
--- a/azalea-auth/src/auth.rs
+++ b/azalea-auth/src/auth.rs
@@ -142,7 +142,7 @@ pub async fn auth(cache_key: &str, opts: AuthOpts<'_>) -> Result<AuthResult, Aut
&cache_file,
cache_key,
CachedAccount {
- cache_key: cache_key.to_string(),
+ cache_key: cache_key.to_owned(),
mca: res.mca,
msa,
xbl: res.xbl,
@@ -527,7 +527,7 @@ async fn obtain_xsts_for_minecraft(
.json(&json!({
"Properties": {
"SandboxId": "RETAIL",
- "UserTokens": [xbl_auth_token.to_string()]
+ "UserTokens": [xbl_auth_token.to_owned()]
},
"RelyingParty": "rp://api.minecraftservices.com/",
"TokenType": "JWT"
diff --git a/azalea-auth/src/game_profile.rs b/azalea-auth/src/game_profile.rs
index 4f5bccfd..9038ea61 100644
--- a/azalea-auth/src/game_profile.rs
+++ b/azalea-auth/src/game_profile.rs
@@ -202,14 +202,14 @@ mod tests {
profile,
GameProfile {
uuid: Uuid::parse_str("f1a2b3c4-d5e6-f7a8-b9c0-d1e2f3a4b5c6").unwrap(),
- name: "Notch".to_string(),
+ name: "Notch".to_owned(),
properties: {
let mut map = IndexMap::new();
map.insert(
- "qwer".to_string(),
+ "qwer".to_owned(),
ProfilePropertyValue {
- value: "asdf".to_string(),
- signature: Some("zxcv".to_string()),
+ value: "asdf".to_owned(),
+ signature: Some("zxcv".to_owned()),
},
);
GameProfileProperties { map }.into()
diff --git a/azalea-brigadier/src/arguments/bool_argument_type.rs b/azalea-brigadier/src/arguments/bool_argument_type.rs
index 225e985e..5005cda4 100644
--- a/azalea-brigadier/src/arguments/bool_argument_type.rs
+++ b/azalea-brigadier/src/arguments/bool_argument_type.rs
@@ -27,7 +27,7 @@ impl ArgumentType for Boolean {
}
fn examples(&self) -> Vec<String> {
- vec!["true".to_string(), "false".to_string()]
+ vec!["true".to_owned(), "false".to_owned()]
}
}
diff --git a/azalea-brigadier/src/arguments/double_argument_type.rs b/azalea-brigadier/src/arguments/double_argument_type.rs
index 5b5d8cce..f4d1d05f 100644
--- a/azalea-brigadier/src/arguments/double_argument_type.rs
+++ b/azalea-brigadier/src/arguments/double_argument_type.rs
@@ -43,7 +43,7 @@ impl ArgumentType for Double {
fn examples(&self) -> Vec<String> {
vec!["0", "1.2", ".5", "-1", "-.5", "-1234.56"]
.into_iter()
- .map(|s| s.to_string())
+ .map(|s| s.to_owned())
.collect()
}
}
diff --git a/azalea-brigadier/src/arguments/float_argument_type.rs b/azalea-brigadier/src/arguments/float_argument_type.rs
index 8ea3a417..766a733f 100644
--- a/azalea-brigadier/src/arguments/float_argument_type.rs
+++ b/azalea-brigadier/src/arguments/float_argument_type.rs
@@ -43,7 +43,7 @@ impl ArgumentType for Float {
fn examples(&self) -> Vec<String> {
vec!["0", "1.2", ".5", "-1", "-.5", "-1234.56"]
.into_iter()
- .map(|s| s.to_string())
+ .map(|s| s.to_owned())
.collect()
}
}
diff --git a/azalea-brigadier/src/arguments/integer_argument_type.rs b/azalea-brigadier/src/arguments/integer_argument_type.rs
index 9cdb9c34..ea547f06 100644
--- a/azalea-brigadier/src/arguments/integer_argument_type.rs
+++ b/azalea-brigadier/src/arguments/integer_argument_type.rs
@@ -43,7 +43,7 @@ impl ArgumentType for Integer {
fn examples(&self) -> Vec<String> {
vec!["0", "123", "-123"]
.into_iter()
- .map(|s| s.to_string())
+ .map(|s| s.to_owned())
.collect()
}
}
diff --git a/azalea-brigadier/src/arguments/long_argument_type.rs b/azalea-brigadier/src/arguments/long_argument_type.rs
index 1d4b3c9b..de9b27cc 100644
--- a/azalea-brigadier/src/arguments/long_argument_type.rs
+++ b/azalea-brigadier/src/arguments/long_argument_type.rs
@@ -43,7 +43,7 @@ impl ArgumentType for Long {
fn examples(&self) -> Vec<String> {
vec!["0", "123", "-123"]
.into_iter()
- .map(|s| s.to_string())
+ .map(|s| s.to_owned())
.collect()
}
}
diff --git a/azalea-brigadier/src/arguments/string_argument_type.rs b/azalea-brigadier/src/arguments/string_argument_type.rs
index bcb040d6..b074132f 100644
--- a/azalea-brigadier/src/arguments/string_argument_type.rs
+++ b/azalea-brigadier/src/arguments/string_argument_type.rs
@@ -16,10 +16,10 @@ pub enum StringArgument {
impl ArgumentType for StringArgument {
fn parse(&self, reader: &mut StringReader) -> Result<Arc<dyn Any>, CommandSyntaxError> {
let result = match self {
- StringArgument::SingleWord => reader.read_unquoted_string().to_string(),
+ StringArgument::SingleWord => reader.read_unquoted_string().to_owned(),
StringArgument::QuotablePhrase => reader.read_string()?,
StringArgument::GreedyPhrase => {
- let text = reader.remaining().to_string();
+ let text = reader.remaining().to_owned();
reader.cursor = reader.total_length();
text
}
@@ -34,7 +34,7 @@ impl ArgumentType for StringArgument {
StringArgument::GreedyPhrase => vec!["word", "words with spaces", "\"and symbols\""],
}
.into_iter()
- .map(|s| s.to_string())
+ .map(|s| s.to_owned())
.collect()
}
}
diff --git a/azalea-brigadier/src/builder/literal_argument_builder.rs b/azalea-brigadier/src/builder/literal_argument_builder.rs
index ea5db2d3..9761609e 100644
--- a/azalea-brigadier/src/builder/literal_argument_builder.rs
+++ b/azalea-brigadier/src/builder/literal_argument_builder.rs
@@ -7,7 +7,7 @@ pub struct Literal {
impl Literal {
pub fn new(value: &str) -> Self {
Self {
- value: value.to_string(),
+ value: value.to_owned(),
}
}
}
diff --git a/azalea-brigadier/src/builder/required_argument_builder.rs b/azalea-brigadier/src/builder/required_argument_builder.rs
index 5aca8617..01bfc0bc 100644
--- a/azalea-brigadier/src/builder/required_argument_builder.rs
+++ b/azalea-brigadier/src/builder/required_argument_builder.rs
@@ -28,7 +28,7 @@ impl<S> Argument<S> {
custom_suggestions: Option<Arc<dyn SuggestionProvider<S> + Send + Sync>>,
) -> Self {
Self {
- name: name.to_string(),
+ name: name.to_owned(),
parser,
custom_suggestions,
}
diff --git a/azalea-brigadier/src/command_dispatcher.rs b/azalea-brigadier/src/command_dispatcher.rs
index a2024139..ecf5d157 100644
--- a/azalea-brigadier/src/command_dispatcher.rs
+++ b/azalea-brigadier/src/command_dispatcher.rs
@@ -214,7 +214,7 @@ impl<S> CommandDispatcher<S> {
let mut result: Vec<String> = Vec::with_capacity(list.len());
for node in list {
if !Arc::ptr_eq(&node, &self.root) {
- result.push(node.read().name().to_string());
+ result.push(node.read().name().to_owned());
}
}
return result;
@@ -289,7 +289,7 @@ impl<S> CommandDispatcher<S> {
match &node.redirect {
Some(redirect) => {
let redirect = if ptr::eq(redirect.data_ptr(), self.root.data_ptr()) {
- "...".to_string()
+ "...".to_owned()
} else {
format!("-> {}", redirect.read().usage_text())
};
@@ -367,7 +367,7 @@ impl<S> CommandDispatcher<S> {
if let Some(redirect) = &node.redirect {
let redirect = if ptr::eq(redirect.data_ptr(), self.root.data_ptr()) {
- "...".to_string()
+ "...".to_owned()
} else {
format!("-> {}", redirect.read().usage_text())
};
diff --git a/azalea-brigadier/src/context/command_context_builder.rs b/azalea-brigadier/src/context/command_context_builder.rs
index f8d4334d..a3819246 100644
--- a/azalea-brigadier/src/context/command_context_builder.rs
+++ b/azalea-brigadier/src/context/command_context_builder.rs
@@ -77,7 +77,7 @@ impl<'a, S> CommandContextBuilder<'a, S> {
self
}
pub fn with_argument(&mut self, name: &str, argument: ParsedArgument) -> &Self {
- self.arguments.insert(name.to_string(), argument);
+ self.arguments.insert(name.to_owned(), argument);
self
}
pub fn with_node(&mut self, node: Arc<RwLock<CommandNode<S>>>, range: StringRange) -> &Self {
@@ -102,7 +102,7 @@ impl<'a, S> CommandContextBuilder<'a, S> {
range: self.range,
forks: self.forks,
modifier: self.modifier.clone(),
- input: input.to_string(),
+ input: input.to_owned(),
}
}
diff --git a/azalea-brigadier/src/errors/command_syntax_error.rs b/azalea-brigadier/src/errors/command_syntax_error.rs
index a476fec4..fd97b050 100644
--- a/azalea-brigadier/src/errors/command_syntax_error.rs
+++ b/azalea-brigadier/src/errors/command_syntax_error.rs
@@ -20,7 +20,7 @@ impl CommandSyntaxError {
Self {
kind,
message,
- input: Some(input.to_string()),
+ input: Some(input.to_owned()),
cursor: Some(cursor),
}
}
diff --git a/azalea-brigadier/src/string_reader.rs b/azalea-brigadier/src/string_reader.rs
index 8dd41ed3..e3ab99ff 100644
--- a/azalea-brigadier/src/string_reader.rs
+++ b/azalea-brigadier/src/string_reader.rs
@@ -20,7 +20,7 @@ impl From<String> for StringReader {
impl From<&str> for StringReader {
fn from(string: &str) -> Self {
Self {
- string: string.to_string(),
+ string: string.to_owned(),
cursor: 0,
}
}
@@ -104,7 +104,7 @@ impl StringReader {
if result.is_err() {
self.cursor = start;
return Err(BuiltInError::ReaderInvalidInt {
- value: number.to_string(),
+ value: number.to_owned(),
}
.create_with_context(self));
}
@@ -125,7 +125,7 @@ impl StringReader {
if result.is_err() {
self.cursor = start;
return Err(BuiltInError::ReaderInvalidLong {
- value: number.to_string(),
+ value: number.to_owned(),
}
.create_with_context(self));
}
@@ -146,7 +146,7 @@ impl StringReader {
if result.is_err() {
self.cursor = start;
return Err(BuiltInError::ReaderInvalidDouble {
- value: number.to_string(),
+ value: number.to_owned(),
}
.create_with_context(self));
}
@@ -167,7 +167,7 @@ impl StringReader {
if result.is_err() {
self.cursor = start;
return Err(BuiltInError::ReaderInvalidFloat {
- value: number.to_string(),
+ value: number.to_owned(),
}
.create_with_context(self));
}
@@ -240,7 +240,7 @@ impl StringReader {
self.skip();
return self.read_string_until(next);
}
- Ok(self.read_unquoted_string().to_string())
+ Ok(self.read_unquoted_string().to_owned())
}
pub fn read_boolean(&mut self) -> Result<bool, CommandSyntaxError> {
diff --git a/azalea-brigadier/src/suggestion/mod.rs b/azalea-brigadier/src/suggestion/mod.rs
index 8a43489a..9c2c57f5 100644
--- a/azalea-brigadier/src/suggestion/mod.rs
+++ b/azalea-brigadier/src/suggestion/mod.rs
@@ -41,7 +41,7 @@ impl Suggestion {
pub fn new(range: StringRange, text: &str) -> Suggestion {
Suggestion {
range,
- value: SuggestionValue::Text(text.to_string()),
+ value: SuggestionValue::Text(text.to_owned()),
tooltip: None,
}
}
@@ -49,7 +49,7 @@ impl Suggestion {
pub fn new_with_tooltip(range: StringRange, text: &str, tooltip: String) -> Self {
Self {
range,
- value: SuggestionValue::Text(text.to_string()),
+ value: SuggestionValue::Text(text.to_owned()),
tooltip: Some(tooltip),
}
}
diff --git a/azalea-brigadier/src/suggestion/suggestions_builder.rs b/azalea-brigadier/src/suggestion/suggestions_builder.rs
index 85c8f4d8..06228947 100644
--- a/azalea-brigadier/src/suggestion/suggestions_builder.rs
+++ b/azalea-brigadier/src/suggestion/suggestions_builder.rs
@@ -21,10 +21,10 @@ impl SuggestionsBuilder {
pub fn new_with_lowercase(input: &str, input_lowercase: &str, start: usize) -> Self {
Self {
start,
- input: input.to_string(),
- input_lowercase: input_lowercase.to_string(),
- remaining: input[start..].to_string(),
- remaining_lowercase: input_lowercase[start..].to_string(),
+ input: input.to_owned(),
+ input_lowercase: input_lowercase.to_owned(),
+ remaining: input[start..].to_owned(),
+ remaining_lowercase: input_lowercase[start..].to_owned(),
result: HashSet::new(),
}
}
@@ -57,7 +57,7 @@ impl SuggestionsBuilder {
}
self.result.insert(Suggestion {
range: StringRange::between(self.start, self.input.len()),
- value: SuggestionValue::Text(text.to_string()),
+ value: SuggestionValue::Text(text.to_owned()),
tooltip: None,
});
self
@@ -69,7 +69,7 @@ impl SuggestionsBuilder {
}
self.result.insert(Suggestion {
range: StringRange::between(self.start, self.input.len()),
- value: SuggestionValue::Text(text.to_string()),
+ value: SuggestionValue::Text(text.to_owned()),
tooltip: Some(tooltip),
});
self
diff --git a/azalea-brigadier/src/tree/mod.rs b/azalea-brigadier/src/tree/mod.rs
index a8c12117..b9b11fd6 100644
--- a/azalea-brigadier/src/tree/mod.rs
+++ b/azalea-brigadier/src/tree/mod.rs
@@ -126,7 +126,7 @@ impl<S> CommandNode<S> {
}
} else {
self.children
- .insert(node.read().name().to_string(), node.clone());
+ .insert(node.read().name().to_owned(), node.clone());
match &node.read().value {
ArgumentBuilderType::Literal(literal) => {
self.literals.insert(literal.value.clone(), node.clone());
diff --git a/azalea-brigadier/tests/command_dispatcher_test.rs b/azalea-brigadier/tests/command_dispatcher_test.rs
index a9dea5bf..d6a3f2cc 100644
--- a/azalea-brigadier/tests/command_dispatcher_test.rs
+++ b/azalea-brigadier/tests/command_dispatcher_test.rs
@@ -337,7 +337,7 @@ fn get_path() {
assert_eq!(
subject.get_path(bar),
- vec!["foo".to_string(), "bar".to_string()]
+ vec!["foo".to_owned(), "bar".to_owned()]
);
}
diff --git a/azalea-brigadier/tests/string_reader_test.rs b/azalea-brigadier/tests/string_reader_test.rs
index 3b70043b..0f0c4171 100644
--- a/azalea-brigadier/tests/string_reader_test.rs
+++ b/azalea-brigadier/tests/string_reader_test.rs
@@ -2,7 +2,7 @@ use azalea_brigadier::{errors::BuiltInError, string_reader::StringReader};
#[test]
fn can_read() {
- let mut reader = StringReader::from("abc".to_string());
+ let mut reader = StringReader::from("abc".to_owned());
assert!(reader.can_read());
reader.skip(); // 'a'
assert!(reader.can_read());
@@ -14,7 +14,7 @@ fn can_read() {
#[test]
fn get_remaining_length() {
- let mut reader = StringReader::from("abc".to_string());
+ let mut reader = StringReader::from("abc".to_owned());
assert_eq!(reader.remaining_length(), 3);
reader.cursor = 1;
assert_eq!(reader.remaining_length(), 2);
@@ -26,7 +26,7 @@ fn get_remaining_length() {
#[test]
fn can_read_length() {
- let reader = StringReader::from("abc".to_string());
+ let reader = StringReader::from("abc".to_owned());
assert!(reader.can_read_length(1));
assert!(reader.can_read_length(2));
assert!(reader.can_read_length(3));
@@ -36,7 +36,7 @@ fn can_read_length() {
#[test]
fn peek() {
- let mut reader = StringReader::from("abc".to_string());
+ let mut reader = StringReader::from("abc".to_owned());
assert_eq!(reader.peek(), 'a');
assert_eq!(reader.cursor(), 0);
reader.cursor = 2;
@@ -46,7 +46,7 @@ fn peek() {
#[test]
fn peek_length() {
- let mut reader = StringReader::from("abc".to_string());
+ let mut reader = StringReader::from("abc".to_owned());
assert_eq!(reader.peek_offset(0), 'a');
assert_eq!(reader.peek_offset(2), 'c');
assert_eq!(reader.cursor(), 0);
@@ -57,7 +57,7 @@ fn peek_length() {
#[test]
fn read() {
- let mut reader = StringReader::from("abc".to_string());
+ let mut reader = StringReader::from("abc".to_owned());
assert_eq!(reader.read(), 'a');
assert_eq!(reader.read(), 'b');
assert_eq!(reader.read(), 'c');
@@ -66,14 +66,14 @@ fn read() {
#[test]
fn skip() {
- let mut reader = StringReader::from("abc".to_string());
+ let mut reader = StringReader::from("abc".to_owned());
reader.skip();
assert_eq!(reader.cursor(), 1);
}
#[test]
fn get_remaining() {
- let mut reader = StringReader::from("Hello!".to_string());
+ let mut reader = StringReader::from("Hello!".to_owned());
assert_eq!(reader.remaining(), "Hello!");
reader.cursor = 3;
assert_eq!(reader.remaining(), "lo!");
@@ -83,7 +83,7 @@ fn get_remaining() {
#[test]
fn get_read() {
- let mut reader = StringReader::from("Hello!".to_string());
+ let mut reader = StringReader::from("Hello!".to_owned());
assert_eq!(reader.get_read(), "");
reader.cursor = 3;
assert_eq!(reader.get_read(), "Hel");
@@ -93,28 +93,28 @@ fn get_read() {
#[test]
fn skip_whitespace_none() {
- let mut reader = StringReader::from("Hello!".to_string());
+ let mut reader = StringReader::from("Hello!".to_owned());
reader.skip_whitespace();
assert_eq!(reader.cursor(), 0);
}
#[test]
fn skip_whitespace_mixed() {
- let mut reader = StringReader::from(" \t \t\nHello!".to_string());
+ let mut reader = StringReader::from(" \t \t\nHello!".to_owned());
reader.skip_whitespace();
assert_eq!(reader.cursor(), 5);
}
#[test]
fn skip_whitespace_empty() {
- let mut reader = StringReader::from("".to_string());
+ let mut reader = StringReader::from("".to_owned());
reader.skip_whitespace();
assert_eq!(reader.cursor(), 0);
}
#[test]
fn read_unquoted_string() {
- let mut reader = StringReader::from("hello world".to_string());
+ let mut reader = StringReader::from("hello world".to_owned());
assert_eq!(reader.read_unquoted_string(), "hello");
assert_eq!(reader.get_read(), "hello");
assert_eq!(reader.remaining(), " world");
@@ -122,7 +122,7 @@ fn read_unquoted_string() {
#[test]
fn read_unquoted_string_empty() {
- let mut reader = StringReader::from("".to_string());
+ let mut reader = StringReader::from("".to_owned());
assert_eq!(reader.read_unquoted_string(), "");
assert_eq!(reader.get_read(), "");
assert_eq!(reader.remaining(), "");
@@ -130,7 +130,7 @@ fn read_unquoted_string_empty() {
#[test]
fn read_unquoted_string_empty_with_remaining() {
- let mut reader = StringReader::from(" hello world".to_string());
+ let mut reader = StringReader::from(" hello world".to_owned());
assert_eq!(reader.read_unquoted_string(), "");
assert_eq!(reader.get_read(), "");
assert_eq!(reader.remaining(), " hello world");
@@ -138,7 +138,7 @@ fn read_unquoted_string_empty_with_remaining() {
#[test]
fn read_quoted_string() {
- let mut reader = StringReader::from("\"hello world\"".to_string());
+ let mut reader = StringReader::from("\"hello world\"".to_owned());
assert_eq!(reader.read_quoted_string().unwrap(), "hello world");
assert_eq!(reader.get_read(), "\"hello world\"");
assert_eq!(reader.remaining(), "");
@@ -146,7 +146,7 @@ fn read_quoted_string() {
#[test]
fn read_single_quoted_string() {
- let mut reader = StringReader::from("'hello world'".to_string());
+ let mut reader = StringReader::from("'hello world'".to_owned());
assert_eq!(reader.read_quoted_string().unwrap(), "hello world");
assert_eq!(reader.get_read(), "'hello world'");
assert_eq!(reader.remaining(), "");
@@ -154,7 +154,7 @@ fn read_single_quoted_string() {
#[test]
fn read_mixed_quoted_string_double_inside_single() {
- let mut reader = StringReader::from("'hello \"world\"'".to_string());
+ let mut reader = StringReader::from("'hello \"world\"'".to_owned());
assert_eq!(reader.read_quoted_string().unwrap(), "hello \"world\"");
assert_eq!(reader.get_read(), "'hello \"world\"'");
assert_eq!(reader.remaining(), "");
@@ -162,7 +162,7 @@ fn read_mixed_quoted_string_double_inside_single() {
#[test]
fn read_mixed_quoted_string_single_inside_double() {
- let mut reader = StringReader::from("\"hello 'world'\"".to_string());
+ let mut reader = StringReader::from("\"hello 'world'\"".to_owned());
assert_eq!(reader.read_quoted_string().unwrap(), "hello 'world'");
assert_eq!(reader.get_read(), "\"hello 'world'\"");
assert_eq!(reader.remaining(), "");
@@ -170,7 +170,7 @@ fn read_mixed_quoted_string_single_inside_double() {
#[test]
fn read_quoted_string_empty_quoted() {
- let mut reader = StringReader::from("".to_string());
+ let mut reader = StringReader::from("".to_owned());
assert_eq!(reader.read_quoted_string().unwrap(), "");
assert_eq!(reader.get_read(), "");
assert_eq!(reader.remaining(), "");
@@ -178,7 +178,7 @@ fn read_quoted_string_empty_quoted() {
#[test]
fn read_quoted_string_empty_quoted_with_remaining() {
- let mut reader = StringReader::from("\"\" hello world".to_string());
+ let mut reader = StringReader::from("\"\" hello world".to_owned());
assert_eq!(reader.read_quoted_string().unwrap(), "");
assert_eq!(reader.get_read(), "\"\"");
assert_eq!(reader.remaining(), " hello world");
@@ -186,7 +186,7 @@ fn read_quoted_string_empty_quoted_with_remaining() {
#[test]
fn read_quoted_string_with_escaped_quote() {
- let mut reader = StringReader::from("\"hello \\\"world\\\"\"".to_string());
+ let mut reader = StringReader::from("\"hello \\\"world\\\"\"".to_owned());
assert_eq!(reader.read_quoted_string().unwrap(), "hello \"world\"");
assert_eq!(reader.get_read(), "\"hello \\\"world\\\"\"");
assert_eq!(reader.remaining(), "");
@@ -194,7 +194,7 @@ fn read_quoted_string_with_escaped_quote() {
#[test]
fn read_quoted_string_with_escaped_escapes() {
- let mut reader = StringReader::from("\"\\\\o/\"".to_string());
+ let mut reader = StringReader::from("\"\\\\o/\"".to_owned());
assert_eq!(reader.read_quoted_string().unwrap(), "\\o/");
assert_eq!(reader.get_read(), "\"\\\\o/\"");
assert_eq!(reader.remaining(), "");
@@ -202,7 +202,7 @@ fn read_quoted_string_with_escaped_escapes() {
#[test]
fn read_quoted_string_with_remaining() {
- let mut reader = StringReader::from("\"hello world\" foo bar".to_string());
+ let mut reader = StringReader::from("\"hello world\" foo bar".to_owned());
assert_eq!(reader.read_quoted_string().unwrap(), "hello world");
assert_eq!(reader.get_read(), "\"hello world\"");
assert_eq!(reader.remaining(), " foo bar");
@@ -210,7 +210,7 @@ fn read_quoted_string_with_remaining() {
#[test]
fn read_quoted_string_with_immediate_remaining() {
- let mut reader = StringReader::from("\"hello world\"foo bar".to_string());
+ let mut reader = StringReader::from("\"hello world\"foo bar".to_owned());
assert_eq!(reader.read_quoted_string().unwrap(), "hello world");
assert_eq!(reader.get_read(), "\"hello world\"");
assert_eq!(reader.remaining(), "foo bar");
@@ -218,7 +218,7 @@ fn read_quoted_string_with_immediate_remaining() {
#[test]
fn read_quoted_string_no_open() {
- let mut reader = StringReader::from("hello world\"".to_string());
+ let mut reader = StringReader::from("hello world\"".to_owned());
let result = reader.read_quoted_string();
assert!(result.is_err());
if let Err(e) = result {
@@ -229,7 +229,7 @@ fn read_quoted_string_no_open() {
#[test]
fn read_quoted_string_no_close() {
- let mut reader = StringReader::from("\"hello world".to_string());
+ let mut reader = StringReader::from("\"hello world".to_owned());
let result = reader.read_quoted_string();
assert!(result.is_err());
if let Err(e) = result {
@@ -240,7 +240,7 @@ fn read_quoted_string_no_close() {
#[test]
fn read_quoted_string_invalid_escape() {
- let mut reader = StringReader::from("\"hello\\nworld\"".to_string());
+ let mut reader = StringReader::from("\"hello\\nworld\"".to_owned());
let result = reader.read_quoted_string();
assert!(result.is_err());
if let Err(e) = result {
@@ -254,7 +254,7 @@ fn read_quoted_string_invalid_escape() {
#[test]
fn read_quoted_string_invalid_quote_escape() {
- let mut reader = StringReader::from("'hello\\\"\'world".to_string());
+ let mut reader = StringReader::from("'hello\\\"\'world".to_owned());
let result = reader.read_quoted_string();
assert!(result.is_err());
if let Err(e) = result {
@@ -268,7 +268,7 @@ fn read_quoted_string_invalid_quote_escape() {
#[test]
fn read_string_no_quotes() {
- let mut reader = StringReader::from("hello world".to_string());
+ let mut reader = StringReader::from("hello world".to_owned());
assert_eq!(reader.read_string().unwrap(), "hello");
assert_eq!(reader.get_read(), "hello");
assert_eq!(reader.remaining(), " world");
@@ -276,7 +276,7 @@ fn read_string_no_quotes() {
#[test]
fn read_string_single_quotes() {
- let mut reader = StringReader::from("'hello world'".to_string());
+ let mut reader = StringReader::from("'hello world'".to_owned());
assert_eq!(reader.read_string().unwrap(), "hello world");
assert_eq!(reader.get_read(), "'hello world'");
assert_eq!(reader.remaining(), "");
@@ -284,7 +284,7 @@ fn read_string_single_quotes() {
#[test]
fn read_string_double_quotes() {
- let mut reader = StringReader::from("\"hello world\"".to_string());
+ let mut reader = StringReader::from("\"hello world\"".to_owned());
assert_eq!(reader.read_string().unwrap(), "hello world");
assert_eq!(reader.get_read(), "\"hello world\"");
assert_eq!(reader.remaining(), "");
@@ -292,7 +292,7 @@ fn read_string_double_quotes() {
#[test]
fn read_int() {
- let mut reader = StringReader::from("1234567890".to_string());
+ let mut reader = StringReader::from("1234567890".to_owned());
assert_eq!(reader.read_int().unwrap(), 1234567890);
assert_eq!(reader.get_read(), "1234567890");
assert_eq!(reader.remaining(), "");
@@ -300,7 +300,7 @@ fn read_int() {
#[test]
fn read_int_negative() {
- let mut reader = StringReader::from("-1234567890".to_string());
+ let mut reader = StringReader::from("-1234567890".to_owned());
assert_eq!(reader.read_int().unwrap(), -1234567890);
assert_eq!(reader.get_read(), "-1234567890");
assert_eq!(reader.remaining(), "");
@@ -308,14 +308,14 @@ fn read_int_negative() {
#[test]
fn read_int_invalid() {
- let mut reader = StringReader::from("12.34".to_string());
+ let mut reader = StringReader::from("12.34".to_owned());
let result = reader.read_int();
assert!(result.is_err());
if let Err(e) = result {
assert_eq!(
e.kind(),
&BuiltInError::ReaderInvalidInt {
- value: "12.34".to_string()
+ value: "12.34".to_owned()
}
);
assert_eq!(e.cursor(), Some(0));
@@ -324,7 +324,7 @@ fn read_int_invalid() {
#[test]
fn read_int_none() {
- let mut reader = StringReader::from("".to_string());
+ let mut reader = StringReader::from("".to_owned());
let result = reader.read_int();
assert!(result.is_err());
if let Err(e) = result {
@@ -335,7 +335,7 @@ fn read_int_none() {
#[test]
fn read_int_with_remaining() {
- let mut reader = StringReader::from("1234567890 foo bar".to_string());
+ let mut reader = StringReader::from("1234567890 foo bar".to_owned());
assert_eq!(reader.read_int().unwrap(), 1234567890);
assert_eq!(reader.get_read(), "1234567890");
assert_eq!(reader.remaining(), " foo bar");
@@ -343,7 +343,7 @@ fn read_int_with_remaining() {
#[test]
fn read_int_with_remaining_immediate() {
- let mut reader = StringReader::from("1234567890foo bar".to_string());
+ let mut reader = StringReader::from("1234567890foo bar".to_owned());
assert_eq!(reader.read_int().unwrap(), 1234567890);
assert_eq!(reader.get_read(), "1234567890");
assert_eq!(reader.remaining(), "foo bar");
@@ -351,7 +351,7 @@ fn read_int_with_remaining_immediate() {
#[test]
fn read_long() {
- let mut reader = StringReader::from("1234567890".to_string());
+ let mut reader = StringReader::from("1234567890".to_owned());
assert_eq!(reader.read_long().unwrap(), 1234567890);
assert_eq!(reader.get_read(), "1234567890");
assert_eq!(reader.remaining(), "");
@@ -359,7 +359,7 @@ fn read_long() {
#[test]
fn read_long_negative() {
- let mut reader = StringReader::from("-1234567890".to_string());
+ let mut reader = StringReader::from("-1234567890".to_owned());
assert_eq!(reader.read_long().unwrap(), -1234567890);
assert_eq!(reader.get_read(), "-1234567890");
assert_eq!(reader.remaining(), "");
@@ -367,14 +367,14 @@ fn read_long_negative() {
#[test]
fn read_long_invalid() {
- let mut reader = StringReader::from("12.34".to_string());
+ let mut reader = StringReader::from("12.34".to_owned());
let result = reader.read_long();
assert!(result.is_err());
if let Err(e) = result {
assert_eq!(
e.kind(),
&BuiltInError::ReaderInvalidLong {
- value: "12.34".to_string()
+ value: "12.34".to_owned()
}
);
assert_eq!(e.cursor(), Some(0));
@@ -383,7 +383,7 @@ fn read_long_invalid() {
#[test]
fn read_long_none() {
- let mut reader = StringReader::from("".to_string());
+ let mut reader = StringReader::from("".to_owned());
let result = reader.read_long();
assert!(result.is_err());
if let Err(e) = result {
@@ -394,7 +394,7 @@ fn read_long_none() {
#[test]
fn read_long_with_remaining() {
- let mut reader = StringReader::from("1234567890 foo bar".to_string());
+ let mut reader = StringReader::from("1234567890 foo bar".to_owned());
assert_eq!(reader.read_long().unwrap(), 1234567890);
assert_eq!(reader.get_read(), "1234567890");
assert_eq!(reader.remaining(), " foo bar");
@@ -402,7 +402,7 @@ fn read_long_with_remaining() {
#[test]
fn read_long_with_remaining_immediate() {
- let mut reader = StringReader::from("1234567890foo bar".to_string());
+ let mut reader = StringReader::from("1234567890foo bar".to_owned());
assert_eq!(reader.read_long().unwrap(), 1234567890);
assert_eq!(reader.get_read(), "1234567890");
assert_eq!(reader.remaining(), "foo bar");
@@ -410,7 +410,7 @@ fn read_long_with_remaining_immediate() {
#[test]
fn read_double() {
- let mut reader = StringReader::from("123".to_string());
+ let mut reader = StringReader::from("123".to_owned());
assert_eq!(reader.read_double().unwrap(), 123.0);
assert_eq!(reader.get_read(), "123");
assert_eq!(reader.remaining(), "");
@@ -418,7 +418,7 @@ fn read_double() {
#[test]
fn read_double_with_decimal() {
- let mut reader = StringReader::from("12.34".to_string());
+ let mut reader = StringReader::from("12.34".to_owned());
assert_eq!(reader.read_double().unwrap(), 12.34);
assert_eq!(reader.get_read(), "12.34");
assert_eq!(reader.remaining(), "");
@@ -426,7 +426,7 @@ fn read_double_with_decimal() {
#[test]
fn read_double_negative() {
- let mut reader = StringReader::from("-123".to_string());
+ let mut reader = StringReader::from("-123".to_owned());
assert_eq!(reader.read_double().unwrap(), -123.0);
assert_eq!(reader.get_read(), "-123");
assert_eq!(reader.remaining(), "");
@@ -434,14 +434,14 @@ fn read_double_negative() {
#[test]
fn read_double_invalid() {
- let mut reader = StringReader::from("12.34.56".to_string());
+ let mut reader = StringReader::from("12.34.56".to_owned());
let result = reader.read_double();
assert!(result.is_err());
if let Err(e) = result {
assert_eq!(
e.kind(),
&BuiltInError::ReaderInvalidDouble {
- value: "12.34.56".to_string()
+ value: "12.34.56".to_owned()
}
);
assert_eq!(e.cursor(), Some(0));
@@ -450,7 +450,7 @@ fn read_double_invalid() {
#[test]
fn read_double_none() {
- let mut reader = StringReader::from("".to_string());
+ let mut reader = StringReader::from("".to_owned());
let result = reader.read_double();
assert!(result.is_err());
if let Err(e) = result {
@@ -461,7 +461,7 @@ fn read_double_none() {
#[test]
fn read_double_with_remaining() {
- let mut reader = StringReader::from("12.34 foo bar".to_string());
+ let mut reader = StringReader::from("12.34 foo bar".to_owned());
assert_eq!(reader.read_double().unwrap(), 12.34);
assert_eq!(reader.get_read(), "12.34");
assert_eq!(reader.remaining(), " foo bar");
@@ -469,7 +469,7 @@ fn read_double_with_remaining() {
#[test]
fn read_double_with_remaining_immediate() {
- let mut reader = StringReader::from("12.34foo bar".to_string());
+ let mut reader = StringReader::from("12.34foo bar".to_owned());
assert_eq!(reader.read_double().unwrap(), 12.34);
assert_eq!(reader.get_read(), "12.34");
assert_eq!(reader.remaining(), "foo bar");
@@ -477,7 +477,7 @@ fn read_double_with_remaining_immediate() {
#[test]
fn read_float() {
- let mut reader = StringReader::from("123".to_string());
+ let mut reader = StringReader::from("123".to_owned());
assert_eq!(reader.read_float().unwrap(), 123.0f32);
assert_eq!(reader.get_read(), "123");
assert_eq!(reader.remaining(), "");
@@ -485,7 +485,7 @@ fn read_float() {
#[test]
fn read_float_with_decimal() {
- let mut reader = StringReader::from("12.34".to_string());
+ let mut reader = StringReader::from("12.34".to_owned());
assert_eq!(reader.read_float().unwrap(), 12.34f32);
assert_eq!(reader.get_read(), "12.34");
assert_eq!(reader.remaining(), "");
@@ -493,7 +493,7 @@ fn read_float_with_decimal() {
#[test]
fn read_float_negative() {
- let mut reader = StringReader::from("-123".to_string());
+ let mut reader = StringReader::from("-123".to_owned());
assert_eq!(reader.read_float().unwrap(), -123.0f32);
assert_eq!(reader.get_read(), "-123");
assert_eq!(reader.remaining(), "");
@@ -501,14 +501,14 @@ fn read_float_negative() {
#[test]
fn read_float_invalid() {
- let mut reader = StringReader::from("12.34.56".to_string());
+ let mut reader = StringReader::from("12.34.56".to_owned());
let result = reader.read_float();
assert!(result.is_err());
if let Err(e) = result {
assert_eq!(
e.kind(),
&BuiltInError::ReaderInvalidFloat {
- value: "12.34.56".to_string()
+ value: "12.34.56".to_owned()
}
);
assert_eq!(e.cursor(), Some(0));
@@ -517,7 +517,7 @@ fn read_float_invalid() {
#[test]
fn read_float_none() {
- let mut reader = StringReader::from("".to_string());
+ let mut reader = StringReader::from("".to_owned());
let result = reader.read_float();
assert!(result.is_err());
if let Err(e) = result {
@@ -528,7 +528,7 @@ fn read_float_none() {
#[test]
fn read_float_with_remaining() {
- let mut reader = StringReader::from("12.34 foo bar".to_string());
+ let mut reader = StringReader::from("12.34 foo bar".to_owned());
assert_eq!(reader.read_float().unwrap(), 12.34f32);
assert_eq!(reader.get_read(), "12.34");
assert_eq!(reader.remaining(), " foo bar");
@@ -536,7 +536,7 @@ fn read_float_with_remaining() {
#[test]
fn read_float_with_remaining_immediate() {
- let mut reader = StringReader::from("12.34foo bar".to_string());
+ let mut reader = StringReader::from("12.34foo bar".to_owned());
assert_eq!(reader.read_float().unwrap(), 12.34f32);
assert_eq!(reader.get_read(), "12.34");
assert_eq!(reader.remaining(), "foo bar");
@@ -544,14 +544,14 @@ fn read_float_with_remaining_immediate() {
#[test]
fn expect_correct() {
- let mut reader = StringReader::from("abc".to_string());
+ let mut reader = StringReader::from("abc".to_owned());
reader.expect('a').unwrap();
assert_eq!(reader.cursor(), 1);
}
#[test]
fn expect_incorrect() {
- let mut reader = StringReader::from("bcd".to_string());
+ let mut reader = StringReader::from("bcd".to_owned());
let result = reader.expect('a');
assert!(result.is_err());
if let Err(e) = result {
@@ -565,7 +565,7 @@ fn expect_incorrect() {
#[test]
fn expect_none() {
- let mut reader = StringReader::from("".to_string());
+ let mut reader = StringReader::from("".to_owned());
let result = reader.expect('a');
assert!(result.is_err());
if let Err(e) = result {
@@ -579,21 +579,21 @@ fn expect_none() {
#[test]
fn read_boolean_correct() {
- let mut reader = StringReader::from("true".to_string());
+ let mut reader = StringReader::from("true".to_owned());
assert!(reader.read_boolean().unwrap());
assert_eq!(reader.get_read(), "true");
}
#[test]
fn read_boolean_incorrect() {
- let mut reader = StringReader::from("tuesday".to_string());
+ let mut reader = StringReader::from("tuesday".to_owned());
let result = reader.read_boolean();
assert!(result.is_err());
if let Err(e) = result {
assert_eq!(
e.kind(),
&BuiltInError::ReaderInvalidBool {
- value: "tuesday".to_string()
+ value: "tuesday".to_owned()
}
);
assert_eq!(e.cursor(), Some(0));
@@ -602,7 +602,7 @@ fn read_boolean_incorrect() {
#[test]
fn read_boolean_none() {
- let mut reader = StringReader::from("".to_string());
+ let mut reader = StringReader::from("".to_owned());
let result = reader.read_boolean();
assert!(result.is_err());
if let Err(e) = result {
diff --git a/azalea-brigadier/tests/suggestion/suggestions_builder_test.rs b/azalea-brigadier/tests/suggestion/suggestions_builder_test.rs
index 08ce65d4..000ac7a0 100644
--- a/azalea-brigadier/tests/suggestion/suggestions_builder_test.rs
+++ b/azalea-brigadier/tests/suggestion/suggestions_builder_test.rs
@@ -127,7 +127,7 @@ fn sort_mixed() {
"11", "2", "22", "33", "3a", "4", "6", "8", "30", "32", "a", "a3", "b", "c",
]
.into_iter()
- .map(|s| s.to_string())
+ .map(|s| s.to_owned())
.collect::<HashSet<_>>();
assert_eq!(actual, expected);
}
diff --git a/azalea-buf/src/lib.rs b/azalea-buf/src/lib.rs
index ef3bd3a8..966b1372 100644
--- a/azalea-buf/src/lib.rs
+++ b/azalea-buf/src/lib.rs
@@ -161,7 +161,7 @@ mod tests {
#[test]
fn test_list() {
- let original_vec = vec!["a".to_string(), "bc".to_string(), "def".to_string()];
+ let original_vec = vec!["a".to_owned(), "bc".to_owned(), "def".to_owned()];
let mut buf = Vec::new();
original_vec.azalea_write(&mut buf).unwrap();
@@ -184,9 +184,9 @@ mod tests {
#[test]
fn test_map() {
let original_map = HashMap::from([
- ("a".to_string(), 1),
- ("bc".to_string(), 23),
- ("def".to_string(), 456),
+ ("a".to_owned(), 1),
+ ("bc".to_owned(), 23),
+ ("def".to_owned(), 456),
]);
let mut buf = Vec::new();
original_map.azalea_write_var(&mut buf).unwrap();
diff --git a/azalea-buf/src/read.rs b/azalea-buf/src/read.rs
index 95dc79ac..a906c8c1 100644
--- a/azalea-buf/src/read.rs
+++ b/azalea-buf/src/read.rs
@@ -103,7 +103,7 @@ fn read_utf_with_len(buf: &mut Cursor<&[u8]>, max_length: u32) -> Result<String,
lossy: String::from_utf8_lossy(buffer).to_string(),
// backtrace: Backtrace::capture(),
})?
- .to_string();
+ .to_owned();
if string.len() > length as usize {
return Err(BufReadError::StringLengthTooLong { length, max_length });
}
@@ -422,7 +422,7 @@ impl AzaleaRead for simdnbt::owned::NbtCompound {
fn azalea_read(buf: &mut Cursor<&[u8]>) -> Result<Self, BufReadError> {
match simdnbt::owned::read_tag(buf).map_err(simdnbt::Error::from)? {
simdnbt::owned::NbtTag::Compound(compound) => Ok(compound),
- _ => Err(BufReadError::Custom("Expected compound tag".to_string())),
+ _ => Err(BufReadError::Custom("Expected compound tag".to_owned())),
}
}
}
diff --git a/azalea-chat/src/component.rs b/azalea-chat/src/component.rs
index c3cc5224..637aafc7 100644
--- a/azalea-chat/src/component.rs
+++ b/azalea-chat/src/component.rs
@@ -100,13 +100,13 @@ impl FormattedText {
/// })).unwrap();
///
/// let ansi = component.to_custom_format(
- /// |running, new| (running.compare_ansi(new), "".to_string()),
+ /// |running, new| (running.compare_ansi(new), "".to_owned()),
/// |text| text.to_string(),
/// |style| {
/// if !style.is_empty() {
- /// "\u{1b}[m".to_string()
+ /// "\u{1b}[m".to_owned()
/// } else {
- /// "".to_string()
+ /// "".to_owned()
/// }
/// },
/// &DEFAULT_STYLE,
@@ -207,8 +207,8 @@ impl FormattedText {
pub fn to_ansi_with_custom_style(&self, default_style: &Style) -> String {
self.to_custom_format(
|running, new| (running.compare_ansi(new), "".to_owned()),
- |text| text.to_string(),
- |style| if !style.is_empty() { "\u{1b}[m" } else { "" }.to_string(),
+ |text| text.to_owned(),
+ |style| if !style.is_empty() { "\u{1b}[m" } else { "" }.to_owned(),
default_style,
)
}
@@ -260,7 +260,7 @@ impl FormattedText {
.replace(">", "&gt;")
.replace("\n", "<br>")
},
- |_| "".to_string(),
+ |_| "".to_owned(),
&DEFAULT_STYLE,
)
}
@@ -297,13 +297,13 @@ impl<'de> Deserialize<'de> for FormattedText {
// if it's primitive, make it a text component
if !json.is_array() && !json.is_object() {
return Ok(FormattedText::Text(TextComponent::new(
- json.as_str().unwrap_or("").to_string(),
+ json.as_str().unwrap_or("").to_owned(),
)));
}
// if it's an object, do things with { text } and stuff
else if json.is_object() {
if let Some(text) = json.get("text") {
- let text = text.as_str().unwrap_or("").to_string();
+ let text = text.as_str().unwrap_or("").to_owned();
component = FormattedText::Text(TextComponent::new(text));
} else if let Some(translate) = json.get("translate") {
let translate = translate
@@ -315,7 +315,7 @@ impl<'de> Deserialize<'de> for FormattedText {
fallback
.as_str()
.ok_or_else(|| de::Error::custom("\"fallback\" must be a string"))?
- .to_string(),
+ .to_owned(),
)
} else {
None
@@ -530,7 +530,7 @@ impl FormattedText {
warn!(
"couldn't parse {item:?} as FormattedText because it has a disallowed primitive"
);
- with_array.push(PrimitiveOrComponent::String("?".to_string()));
+ with_array.push(PrimitiveOrComponent::String("?".to_owned()));
}
} else if let Some(c) = FormattedText::from_nbt_compound(item) {
if let FormattedText::Text(text_component) = c
@@ -545,7 +545,7 @@ impl FormattedText {
));
} else {
warn!("couldn't parse {item:?} as FormattedText");
- with_array.push(PrimitiveOrComponent::String("?".to_string()));
+ with_array.push(PrimitiveOrComponent::String("?".to_owned()));
}
}
} else {
@@ -672,7 +672,7 @@ impl From<String> for FormattedText {
}
impl From<&str> for FormattedText {
fn from(s: &str) -> Self {
- Self::from(s.to_string())
+ Self::from(s.to_owned())
}
}
impl From<TranslatableComponent> for FormattedText {
@@ -721,10 +721,10 @@ mod tests {
assert_eq!(
component,
FormattedText::Translatable(TranslatableComponent::new(
- "translation.test.args".to_string(),
+ "translation.test.args".to_owned(),
vec![
- PrimitiveOrComponent::String("a".to_string()),
- PrimitiveOrComponent::String("b".to_string())
+ PrimitiveOrComponent::String("a".to_owned()),
+ PrimitiveOrComponent::String("b".to_owned())
]
))
);
@@ -744,9 +744,9 @@ mod tests {
assert_eq!(
component,
FormattedText::Translatable(TranslatableComponent::with_fallback(
- "translation.test.undefined".to_string(),
- Some("fallback: %s".to_string()),
- vec![PrimitiveOrComponent::String("a".to_string())]
+ "translation.test.undefined".to_owned(),
+ Some("fallback: %s".to_owned()),
+ vec![PrimitiveOrComponent::String("a".to_owned())]
))
);
}
@@ -768,11 +768,11 @@ mod tests {
assert_eq!(
FormattedText::deserialize(&j).unwrap(),
FormattedText::Translatable(TranslatableComponent::new(
- "commands.list.players".to_string(),
+ "commands.list.players".to_owned(),
vec![
PrimitiveOrComponent::Short(1),
PrimitiveOrComponent::Integer(65536),
- PrimitiveOrComponent::String("<players>".to_string()),
+ PrimitiveOrComponent::String("<players>".to_owned()),
PrimitiveOrComponent::FormattedText(FormattedText::Text(
TextComponent::new("unused")
.with_style(Style::new().color(Some(TextColor::parse("red").unwrap())))
diff --git a/azalea-chat/src/style.rs b/azalea-chat/src/style.rs
index 4982a915..7792f812 100644
--- a/azalea-chat/src/style.rs
+++ b/azalea-chat/src/style.rs
@@ -62,7 +62,7 @@ static LEGACY_FORMAT_TO_COLOR: LazyLock<HashMap<&'static ChatFormatting, TextCol
formatter,
TextColor {
value: formatter.color().unwrap(),
- name: Some(formatter.name().to_string()),
+ name: Some(formatter.name().to_owned()),
},
);
}
@@ -300,7 +300,7 @@ impl TryFrom<ChatFormatting> for TextColor {
return Err(format!("{} is not a color", formatter.name()));
}
let color = formatter.color().unwrap_or(0);
- Ok(Self::new(color, Some(formatter.name().to_string())))
+ Ok(Self::new(color, Some(formatter.name().to_owned())))
}
}
@@ -412,11 +412,8 @@ impl Style {
insertion: j
.get("insertion")
.and_then(|v| v.as_str())
- .map(|s| s.to_string()),
- font: j
- .get("font")
- .and_then(|v| v.as_str())
- .map(|s| s.to_string()),
+ .map(|s| s.to_owned()),
+ font: j.get("font").and_then(|v| v.as_str()).map(|s| s.to_owned()),
}
}
diff --git a/azalea-chat/src/text_component.rs b/azalea-chat/src/text_component.rs
index c21e2d46..ec89a7c9 100644
--- a/azalea-chat/src/text_component.rs
+++ b/azalea-chat/src/text_component.rs
@@ -95,7 +95,7 @@ pub fn legacy_color_code_to_text_component(legacy_color_code: &str) -> TextCompo
if !cur_component.text.is_empty() {
// we need to split this into a new component
components.push(cur_component.clone());
- cur_component.text = "".to_string();
+ cur_component.text = "".to_owned();
};
cur_component.base.style.color = TextColor::parse(&color);
@@ -104,7 +104,7 @@ pub fn legacy_color_code_to_text_component(legacy_color_code: &str) -> TextCompo
if !cur_component.text.is_empty() || formatter == ChatFormatting::Reset {
// we need to split this into a new component
components.push(cur_component.clone());
- cur_component.text = "".to_string();
+ cur_component.text = "".to_owned();
};
cur_component.base.style.apply_formatting(&formatter);
}
@@ -175,7 +175,7 @@ mod tests {
#[test]
fn test_hypixel_motd_ansi() {
let component =
- TextComponent::new("§aHypixel Network §c[1.8-1.18]\n§b§lHAPPY HOLIDAYS".to_string())
+ TextComponent::new("§aHypixel Network §c[1.8-1.18]\n§b§lHAPPY HOLIDAYS".to_owned())
.get();
assert_eq!(
component.to_ansi(),
@@ -193,7 +193,7 @@ mod tests {
#[test]
fn test_hypixel_motd_html() {
let component =
- TextComponent::new("§aHypixel Network §c[1.8-1.18]\n§b§lHAPPY HOLIDAYS".to_string())
+ TextComponent::new("§aHypixel Network §c[1.8-1.18]\n§b§lHAPPY HOLIDAYS".to_owned())
.get();
assert_eq!(
@@ -210,7 +210,7 @@ mod tests {
#[test]
fn test_xss_html() {
- let component = TextComponent::new("§a<b>&\n§b</b>".to_string()).get();
+ let component = TextComponent::new("§a<b>&\n§b</b>".to_owned()).get();
assert_eq!(
component.to_html(),
@@ -225,7 +225,7 @@ mod tests {
#[test]
fn test_legacy_color_code_to_component() {
- let component = TextComponent::new("§lHello §r§1w§2o§3r§4l§5d".to_string()).get();
+ let component = TextComponent::new("§lHello §r§1w§2o§3r§4l§5d".to_owned()).get();
assert_eq!(
component.to_ansi(),
format!(
@@ -244,7 +244,7 @@ mod tests {
#[test]
fn test_legacy_color_code_with_rgb() {
- let component = TextComponent::new("§#Ff0000This is a test message".to_string()).get();
+ let component = TextComponent::new("§#Ff0000This is a test message".to_owned()).get();
assert_eq!(
component.to_ansi(),
format!(
diff --git a/azalea-chat/src/translatable_component.rs b/azalea-chat/src/translatable_component.rs
index ae1d80bc..f6be2aa5 100644
--- a/azalea-chat/src/translatable_component.rs
+++ b/azalea-chat/src/translatable_component.rs
@@ -130,7 +130,7 @@ impl TranslatableComponent {
.args
.get(matched)
.cloned()
- .unwrap_or_else(|| PrimitiveOrComponent::String("".to_string()));
+ .unwrap_or_else(|| PrimitiveOrComponent::String("".to_owned()));
components.push(TextComponent::new(built_text.clone()));
built_text.clear();
@@ -148,9 +148,7 @@ impl TranslatableComponent {
&self
.args
.get((d - 1) as usize)
- .unwrap_or(&PrimitiveOrComponent::String(
- "".to_string(),
- ))
+ .unwrap_or(&PrimitiveOrComponent::String("".to_owned()))
.to_string(),
);
} else {
@@ -183,7 +181,7 @@ impl TranslatableComponent {
siblings: components.into_iter().map(FormattedText::Text).collect(),
style: Default::default(),
},
- text: "".to_string(),
+ text: "".to_owned(),
})
}
}
@@ -238,7 +236,7 @@ impl From<PrimitiveOrComponent> for TextComponent {
}
impl From<&str> for TranslatableComponent {
fn from(s: &str) -> Self {
- TranslatableComponent::new(s.to_string(), vec![])
+ TranslatableComponent::new(s.to_owned(), vec![])
}
}
@@ -248,88 +246,88 @@ mod tests {
#[test]
fn test_none() {
- let c = TranslatableComponent::new("translation.test.none".to_string(), vec![]);
- assert_eq!(c.read().unwrap().to_string(), "Hello, world!".to_string());
+ let c = TranslatableComponent::new("translation.test.none".to_owned(), vec![]);
+ assert_eq!(c.read().unwrap().to_string(), "Hello, world!".to_owned());
}
#[test]
fn test_complex() {
let c = TranslatableComponent::new(
- "translation.test.complex".to_string(),
+ "translation.test.complex".to_owned(),
vec![
- PrimitiveOrComponent::String("a".to_string()),
- PrimitiveOrComponent::String("b".to_string()),
- PrimitiveOrComponent::String("c".to_string()),
- PrimitiveOrComponent::String("d".to_string()),
+ PrimitiveOrComponent::String("a".to_owned()),
+ PrimitiveOrComponent::String("b".to_owned()),
+ PrimitiveOrComponent::String("c".to_owned()),
+ PrimitiveOrComponent::String("d".to_owned()),
],
);
// so true mojang
assert_eq!(
c.read().unwrap().to_string(),
- "Prefix, ab again b and a lastly c and also a again!".to_string()
+ "Prefix, ab again b and a lastly c and also a again!".to_owned()
);
}
#[test]
fn test_escape() {
let c = TranslatableComponent::new(
- "translation.test.escape".to_string(),
+ "translation.test.escape".to_owned(),
vec![
- PrimitiveOrComponent::String("a".to_string()),
- PrimitiveOrComponent::String("b".to_string()),
- PrimitiveOrComponent::String("c".to_string()),
- PrimitiveOrComponent::String("d".to_string()),
+ PrimitiveOrComponent::String("a".to_owned()),
+ PrimitiveOrComponent::String("b".to_owned()),
+ PrimitiveOrComponent::String("c".to_owned()),
+ PrimitiveOrComponent::String("d".to_owned()),
],
);
- assert_eq!(c.read().unwrap().to_string(), "%s %a %%s %%b".to_string());
+ assert_eq!(c.read().unwrap().to_string(), "%s %a %%s %%b".to_owned());
}
#[test]
fn test_invalid() {
let c = TranslatableComponent::new(
- "translation.test.invalid".to_string(),
+ "translation.test.invalid".to_owned(),
vec![
- PrimitiveOrComponent::String("a".to_string()),
- PrimitiveOrComponent::String("b".to_string()),
- PrimitiveOrComponent::String("c".to_string()),
- PrimitiveOrComponent::String("d".to_string()),
+ PrimitiveOrComponent::String("a".to_owned()),
+ PrimitiveOrComponent::String("b".to_owned()),
+ PrimitiveOrComponent::String("c".to_owned()),
+ PrimitiveOrComponent::String("d".to_owned()),
],
);
- assert_eq!(c.read().unwrap().to_string(), "hi %".to_string());
+ assert_eq!(c.read().unwrap().to_string(), "hi %".to_owned());
}
#[test]
fn test_invalid2() {
let c = TranslatableComponent::new(
- "translation.test.invalid2".to_string(),
+ "translation.test.invalid2".to_owned(),
vec![
- PrimitiveOrComponent::String("a".to_string()),
- PrimitiveOrComponent::String("b".to_string()),
- PrimitiveOrComponent::String("c".to_string()),
- PrimitiveOrComponent::String("d".to_string()),
+ PrimitiveOrComponent::String("a".to_owned()),
+ PrimitiveOrComponent::String("b".to_owned()),
+ PrimitiveOrComponent::String("c".to_owned()),
+ PrimitiveOrComponent::String("d".to_owned()),
],
);
- assert_eq!(c.read().unwrap().to_string(), "hi % s".to_string());
+ assert_eq!(c.read().unwrap().to_string(), "hi % s".to_owned());
}
#[test]
fn test_undefined() {
let c = TranslatableComponent::new(
- "translation.test.undefined".to_string(),
- vec![PrimitiveOrComponent::String("a".to_string())],
+ "translation.test.undefined".to_owned(),
+ vec![PrimitiveOrComponent::String("a".to_owned())],
);
assert_eq!(
c.read().unwrap().to_string(),
- "translation.test.undefined".to_string()
+ "translation.test.undefined".to_owned()
);
}
#[test]
fn test_undefined_with_fallback() {
let c = TranslatableComponent::with_fallback(
- "translation.test.undefined".to_string(),
- Some("translation fallback: %s".to_string()),
- vec![PrimitiveOrComponent::String("a".to_string())],
+ "translation.test.undefined".to_owned(),
+ Some("translation fallback: %s".to_owned()),
+ vec![PrimitiveOrComponent::String("a".to_owned())],
);
assert_eq!(
c.read().unwrap().to_string(),
- "translation fallback: a".to_string()
+ "translation fallback: a".to_owned()
);
}
}
diff --git a/azalea-client/src/account.rs b/azalea-client/src/account.rs
index faaa551a..ea49368e 100644
--- a/azalea-client/src/account.rs
+++ b/azalea-client/src/account.rs
@@ -85,11 +85,11 @@ impl Account {
/// This is useful for testing in LAN worlds.
pub fn offline(username: &str) -> Self {
Self {
- username: username.to_string(),
+ username: username.to_owned(),
access_token: None,
uuid: None,
account_opts: AccountOpts::Offline {
- username: username.to_string(),
+ username: username.to_owned(),
},
#[cfg(feature = "online-mode")]
certs: Arc::new(Mutex::new(None)),
@@ -137,7 +137,7 @@ impl Account {
access_token: Some(Arc::new(Mutex::new(auth_result.access_token))),
uuid: Some(auth_result.profile.id),
account_opts: AccountOpts::Microsoft {
- email: cache_key.to_string(),
+ email: cache_key.to_owned(),
},
// we don't do chat signing by default unless the user asks for it
certs: Arc::new(Mutex::new(None)),
diff --git a/azalea-client/src/plugins/chat/mod.rs b/azalea-client/src/plugins/chat/mod.rs
index e0a41d49..7fd14e26 100644
--- a/azalea-client/src/plugins/chat/mod.rs
+++ b/azalea-client/src/plugins/chat/mod.rs
@@ -198,7 +198,7 @@ impl Client {
pub fn write_chat_packet(&self, message: &str) {
self.ecs.lock().write_message(SendChatKindEvent {
entity: self.entity,
- content: message.to_string(),
+ content: message.to_owned(),
kind: ChatKind::Message,
});
}
@@ -211,7 +211,7 @@ impl Client {
pub fn write_command_packet(&self, command: &str) {
self.ecs.lock().write_message(SendChatKindEvent {
entity: self.entity,
- content: command.to_string(),
+ content: command.to_owned(),
kind: ChatKind::Command,
});
}
diff --git a/azalea-client/src/plugins/disconnect.rs b/azalea-client/src/plugins/disconnect.rs
index 08fe3807..95d1b5ac 100644
--- a/azalea-client/src/plugins/disconnect.rs
+++ b/azalea-client/src/plugins/disconnect.rs
@@ -94,7 +94,7 @@ pub fn remove_components_from_disconnected_players(
if let Some(reason) = reason {
format!(": {reason}")
} else {
- "".to_string()
+ "".to_owned()
}
);
commands
diff --git a/azalea-client/src/plugins/task_pool.rs b/azalea-client/src/plugins/task_pool.rs
index 5e9031d7..3ee7bf03 100644
--- a/azalea-client/src/plugins/task_pool.rs
+++ b/azalea-client/src/plugins/task_pool.rs
@@ -105,7 +105,7 @@ impl TaskPoolOptions {
IoTaskPool::get_or_init(|| {
TaskPoolBuilder::default()
.num_threads(io_threads)
- .thread_name("IO Task Pool".to_string())
+ .thread_name("IO Task Pool".to_owned())
.build()
});
}
@@ -121,7 +121,7 @@ impl TaskPoolOptions {
AsyncComputeTaskPool::get_or_init(|| {
TaskPoolBuilder::default()
.num_threads(async_compute_threads)
- .thread_name("Async Compute Task Pool".to_string())
+ .thread_name("Async Compute Task Pool".to_owned())
.build()
});
}
@@ -136,7 +136,7 @@ impl TaskPoolOptions {
ComputeTaskPool::get_or_init(|| {
TaskPoolBuilder::default()
.num_threads(compute_threads)
- .thread_name("Compute Task Pool".to_string())
+ .thread_name("Compute Task Pool".to_owned())
.build()
});
}
diff --git a/azalea-client/src/test_utils/simulation.rs b/azalea-client/src/test_utils/simulation.rs
index 1946fd6d..5a1c9c52 100644
--- a/azalea-client/src/test_utils/simulation.rs
+++ b/azalea-client/src/test_utils/simulation.rs
@@ -71,10 +71,7 @@ impl Simulation {
// start in the config state
app.world_mut().entity_mut(entity).insert((
InConfigState,
- GameProfileComponent(GameProfile::new(
- Uuid::from_u128(1234),
- "azalea".to_string(),
- )),
+ GameProfileComponent(GameProfile::new(Uuid::from_u128(1234), "azalea".to_owned())),
));
tick_app(&mut app);
diff --git a/azalea-core/src/difficulty.rs b/azalea-core/src/difficulty.rs
index f82f0e9d..427be9aa 100644
--- a/azalea-core/src/difficulty.rs
+++ b/azalea-core/src/difficulty.rs
@@ -7,61 +7,56 @@ use azalea_buf::{AzaleaRead, AzaleaWrite, BufReadError};
#[derive(Hash, Clone, Copy, Debug, PartialEq, Eq)]
pub enum Difficulty {
- PEACEFUL = 0,
- EASY = 1,
- NORMAL = 2,
- HARD = 3,
+ Peaceful = 0,
+ Easy = 1,
+ Normal = 2,
+ Hard = 3,
}
-pub enum Err {
- InvalidDifficulty(String),
-}
+pub struct InvalidDifficultyError(pub String);
-impl Debug for Err {
+impl Debug for InvalidDifficultyError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
- match self {
- Err::InvalidDifficulty(s) => write!(f, "Invalid difficulty: {s}"),
- }
+ write!(f, "Invalid difficulty: {}", self.0)
}
}
impl Difficulty {
pub fn name(&self) -> &'static str {
match self {
- Difficulty::PEACEFUL => "peaceful",
- Difficulty::EASY => "easy",
- Difficulty::NORMAL => "normal",
- Difficulty::HARD => "hard",
+ Difficulty::Peaceful => "peaceful",
+ Difficulty::Easy => "easy",
+ Difficulty::Normal => "normal",
+ Difficulty::Hard => "hard",
}
}
- pub fn from_name(name: &str) -> Result<Difficulty, Err> {
- match name {
- "peaceful" => Ok(Difficulty::PEACEFUL),
- "easy" => Ok(Difficulty::EASY),
- "normal" => Ok(Difficulty::NORMAL),
- "hard" => Ok(Difficulty::HARD),
- _ => Err(Err::InvalidDifficulty(name.to_string())),
- }
+ pub fn from_name(name: &str) -> Result<Difficulty, InvalidDifficultyError> {
+ Ok(match name {
+ "peaceful" => Difficulty::Peaceful,
+ "easy" => Difficulty::Easy,
+ "normal" => Difficulty::Normal,
+ "hard" => Difficulty::Hard,
+ _ => return Err(InvalidDifficultyError(name.to_owned())),
+ })
}
pub fn by_id(id: u8) -> Difficulty {
match id % 4 {
- 0 => Difficulty::PEACEFUL,
- 1 => Difficulty::EASY,
- 2 => Difficulty::NORMAL,
- 3 => Difficulty::HARD,
- // this shouldn't be possible because of the modulo, so panicking is fine
- _ => panic!("Unknown difficulty id: {id}"),
+ 0 => Difficulty::Peaceful,
+ 1 => Difficulty::Easy,
+ 2 => Difficulty::Normal,
+ 3 => Difficulty::Hard,
+ _ => unreachable!(),
}
}
pub fn id(&self) -> u8 {
match self {
- Difficulty::PEACEFUL => 0,
- Difficulty::EASY => 1,
- Difficulty::NORMAL => 2,
- Difficulty::HARD => 3,
+ Difficulty::Peaceful => 0,
+ Difficulty::Easy => 1,
+ Difficulty::Normal => 2,
+ Difficulty::Hard => 3,
}
}
}
@@ -85,28 +80,28 @@ mod tests {
#[test]
fn test_difficulty_from_name() {
assert_eq!(
- Difficulty::PEACEFUL,
+ Difficulty::Peaceful,
Difficulty::from_name("peaceful").unwrap()
);
- assert_eq!(Difficulty::EASY, Difficulty::from_name("easy").unwrap());
- assert_eq!(Difficulty::NORMAL, Difficulty::from_name("normal").unwrap());
- assert_eq!(Difficulty::HARD, Difficulty::from_name("hard").unwrap());
+ assert_eq!(Difficulty::Easy, Difficulty::from_name("easy").unwrap());
+ assert_eq!(Difficulty::Normal, Difficulty::from_name("normal").unwrap());
+ assert_eq!(Difficulty::Hard, Difficulty::from_name("hard").unwrap());
assert!(Difficulty::from_name("invalid").is_err());
}
#[test]
fn test_difficulty_id() {
- assert_eq!(0, Difficulty::PEACEFUL.id());
- assert_eq!(1, Difficulty::EASY.id());
- assert_eq!(2, Difficulty::NORMAL.id());
- assert_eq!(3, Difficulty::HARD.id());
+ assert_eq!(0, Difficulty::Peaceful.id());
+ assert_eq!(1, Difficulty::Easy.id());
+ assert_eq!(2, Difficulty::Normal.id());
+ assert_eq!(3, Difficulty::Hard.id());
}
#[test]
fn test_difficulty_name() {
- assert_eq!("peaceful", Difficulty::PEACEFUL.name());
- assert_eq!("easy", Difficulty::EASY.name());
- assert_eq!("normal", Difficulty::NORMAL.name());
- assert_eq!("hard", Difficulty::HARD.name());
+ assert_eq!("peaceful", Difficulty::Peaceful.name());
+ assert_eq!("easy", Difficulty::Easy.name());
+ assert_eq!("normal", Difficulty::Normal.name());
+ assert_eq!("hard", Difficulty::Hard.name());
}
}
diff --git a/azalea-entity/src/metadata.rs b/azalea-entity/src/metadata.rs
index c3fb480f..0a4e921d 100644
--- a/azalea-entity/src/metadata.rs
+++ b/azalea-entity/src/metadata.rs
@@ -2265,7 +2265,7 @@ impl Default for CommandBlockMinecartMetadataBundle {
custom_display_block: CustomDisplayBlock(azalea_block::BlockState::AIR),
display_offset: DisplayOffset(Default::default()),
},
- command_name: CommandName("".to_string()),
+ command_name: CommandName("".to_owned()),
last_output: LastOutput(Default::default()),
}
}
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<W: ProtocolPacket> {
///
/// // 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<u8> = Vec::new();
diff --git a/azalea-world/src/palette/container.rs b/azalea-world/src/palette/container.rs
index a10c5d78..a6c7454b 100644
--- a/azalea-world/src/palette/container.rs
+++ b/azalea-world/src/palette/container.rs
@@ -134,7 +134,7 @@ impl<S: PalletedContainerKind> PalettedContainer<S> {
Err(e) => {
warn!("Failed to create bit storage: {:?}", e);
return Err(BufReadError::Custom(
- "Failed to create bit storage".to_string(),
+ "Failed to create bit storage".to_owned(),
));
}
};
diff --git a/azalea/examples/testbot/commands/debug.rs b/azalea/examples/testbot/commands/debug.rs
index c5b93c7d..68f06dc3 100644
--- a/azalea/examples/testbot/commands/debug.rs
+++ b/azalea/examples/testbot/commands/debug.rs
@@ -184,7 +184,7 @@ pub fn register(commands: &mut CommandDispatcher<Mutex<CommandSource>>) {
if let Some(queued) = executing_path.queued_path {
queued.len().to_string()
} else {
- "n/a".to_string()
+ "n/a".to_owned()
},
));
1
diff --git a/azalea/examples/testbot/main.rs b/azalea/examples/testbot/main.rs
index 2c282f07..71c5585d 100644
--- a/azalea/examples/testbot/main.rs
+++ b/azalea/examples/testbot/main.rs
@@ -213,9 +213,9 @@ pub struct Args {
}
fn parse_args() -> Args {
- let mut owner_username = "admin".to_string();
+ let mut owner_username = "admin".to_owned();
let mut accounts = Vec::new();
- let mut server = "localhost".to_string();
+ let mut server = "localhost".to_owned();
let mut pathfinder_debug_particles = false;
let mut args = env::args().skip(1);
@@ -243,7 +243,7 @@ fn parse_args() -> Args {
}
if accounts.is_empty() {
- accounts.push("azalea".to_string());
+ accounts.push("azalea".to_owned());
}
Args {
diff --git a/azalea/src/pathfinder/tests.rs b/azalea/src/pathfinder/tests.rs
index 8c573405..6f4f7cb7 100644
--- a/azalea/src/pathfinder/tests.rs
+++ b/azalea/src/pathfinder/tests.rs
@@ -30,7 +30,7 @@ fn setup_blockposgoal_simulation(
// you can uncomment this while debugging tests to get trace logs
// simulation.app.add_plugins(bevy_log::LogPlugin {
// level: bevy_log::Level::TRACE,
- // filter: "".to_string(),
+ // filter: "".to_owned(),
// ..Default::default()
// });