From c652bbc6091212811133466914e7ef39e61a7b21 Mon Sep 17 00:00:00 2001 From: mat Date: Sat, 21 Jan 2023 22:25:22 -0600 Subject: [PATCH] clippy --- azalea-auth/src/auth.rs | 3 +-- azalea-brigadier/src/exceptions/builtin_exceptions.rs | 9 ++------- azalea-buf/azalea-buf-macros/src/read.rs | 2 +- azalea-buf/azalea-buf-macros/src/write.rs | 2 +- azalea-client/src/chat.rs | 3 ++- azalea-core/src/bitset.rs | 4 +--- azalea-world/src/bit_storage.rs | 3 +-- azalea/src/pathfinder/mod.rs | 2 +- bot/src/main.rs | 8 ++++---- 9 files changed, 14 insertions(+), 22 deletions(-) diff --git a/azalea-auth/src/auth.rs b/azalea-auth/src/auth.rs index e668a947..bb72c8c4 100755 --- a/azalea-auth/src/auth.rs +++ b/azalea-auth/src/auth.rs @@ -257,8 +257,7 @@ async fn interactive_get_ms_auth_token( log::trace!("Polling to check if user has logged in..."); if let Ok(access_token_response) = client .post(format!( - "https://login.live.com/oauth20_token.srf?client_id={}", - CLIENT_ID + "https://login.live.com/oauth20_token.srf?client_id={CLIENT_ID}" )) .form(&vec![ ("client_id", CLIENT_ID), diff --git a/azalea-brigadier/src/exceptions/builtin_exceptions.rs b/azalea-brigadier/src/exceptions/builtin_exceptions.rs index c3c3c900..b96b37bf 100755 --- a/azalea-brigadier/src/exceptions/builtin_exceptions.rs +++ b/azalea-brigadier/src/exceptions/builtin_exceptions.rs @@ -83,17 +83,12 @@ impl fmt::Debug for BuiltInExceptions { write!(f, "Unclosed quoted string") } BuiltInExceptions::ReaderInvalidEscape { character } => { - write!( - f, - "Invalid escape sequence '{}' in quoted string", - character - ) + write!(f, "Invalid escape sequence '{character}' in quoted string") } BuiltInExceptions::ReaderInvalidBool { value } => { write!( f, - "Invalid bool, expected true or false but found '{}'", - value + "Invalid bool, expected true or false but found '{value}'", ) } BuiltInExceptions::ReaderInvalidInt { value } => { diff --git a/azalea-buf/azalea-buf-macros/src/read.rs b/azalea-buf/azalea-buf-macros/src/read.rs index 75c71f94..b72e2bf5 100644 --- a/azalea-buf/azalea-buf-macros/src/read.rs +++ b/azalea-buf/azalea-buf-macros/src/read.rs @@ -69,7 +69,7 @@ pub fn create_impl_mcbufreadable(ident: &Ident, data: &Data) -> proc_macro2::Tok variant_discrim = match &d.1 { syn::Expr::Lit(e) => match &e.lit { syn::Lit::Int(i) => i.base10_parse().unwrap(), - _ => panic!("Error parsing enum discriminant as int (is {:?})", e), + _ => panic!("Error parsing enum discriminant as int (is {e:?})",), }, syn::Expr::Unary(_) => { panic!("Negative enum discriminants are not supported") diff --git a/azalea-buf/azalea-buf-macros/src/write.rs b/azalea-buf/azalea-buf-macros/src/write.rs index a711dbdd..67647c06 100644 --- a/azalea-buf/azalea-buf-macros/src/write.rs +++ b/azalea-buf/azalea-buf-macros/src/write.rs @@ -71,7 +71,7 @@ pub fn create_impl_mcbufwritable(ident: &Ident, data: &Data) -> proc_macro2::Tok syn::Expr::Lit(e) => match &e.lit { syn::Lit::Int(i) => i.base10_parse().unwrap(), // syn::Lit::Str(s) => s.value(), - _ => panic!("Error parsing enum discriminant as int (is {:?})", e), + _ => panic!("Error parsing enum discriminant as int (is {e:?})"), }, syn::Expr::Unary(_) => { panic!("Negative enum discriminants are not supported") diff --git a/azalea-client/src/chat.rs b/azalea-client/src/chat.rs index de71f586..91dcf63e 100755 --- a/azalea-client/src/chat.rs +++ b/azalea-client/src/chat.rs @@ -74,7 +74,8 @@ impl ChatPacket { } /// Get the UUID of the sender of the message. If it's not a - /// player-sent chat message, this will be None. + /// player-sent chat message, this will be None (this is sometimes the case + /// when a server uses a plugin to modify chat messages). pub fn uuid(&self) -> Option { match self { ChatPacket::System(_) => None, diff --git a/azalea-core/src/bitset.rs b/azalea-core/src/bitset.rs index 266bdc62..b45a18d2 100755 --- a/azalea-core/src/bitset.rs +++ b/azalea-core/src/bitset.rs @@ -25,9 +25,7 @@ impl BitSet { fn check_range(&self, from_index: usize, to_index: usize) { assert!( from_index <= to_index, - "fromIndex: {} > toIndex: {}", - from_index, - to_index + "fromIndex: {from_index} > toIndex: {to_index}", ); } diff --git a/azalea-world/src/bit_storage.rs b/azalea-world/src/bit_storage.rs index 113f23bc..f6ca4cd6 100755 --- a/azalea-world/src/bit_storage.rs +++ b/azalea-world/src/bit_storage.rs @@ -91,8 +91,7 @@ impl fmt::Display for BitStorageError { match self { BitStorageError::InvalidLength { got, expected } => write!( f, - "Invalid length given for storage, got: {}, but expected: {}", - got, expected + "Invalid length given for storage, got: {got}, but expected: {expected}", ), } } diff --git a/azalea/src/pathfinder/mod.rs b/azalea/src/pathfinder/mod.rs index a1619c41..de62e9a7 100644 --- a/azalea/src/pathfinder/mod.rs +++ b/azalea/src/pathfinder/mod.rs @@ -84,7 +84,7 @@ impl Trait for azalea_client::Client { for possible_move in possible_moves.iter() { edges.push(Edge { target: possible_move.next_node(node), - cost: possible_move.cost(&world, node), + cost: possible_move.cost(world, node), }); } edges diff --git a/bot/src/main.rs b/bot/src/main.rs index 78d61940..1bd407e8 100644 --- a/bot/src/main.rs +++ b/bot/src/main.rs @@ -43,7 +43,7 @@ async fn main() -> anyhow::Result<()> { let mut states = Vec::new(); for i in 0..1 { - accounts.push(Account::offline(&format!("bot{}", i))); + accounts.push(Account::offline(&format!("bot{i}"))); states.push(State::default()); } @@ -98,7 +98,7 @@ async fn handle(mut bot: Client, event: Event, _state: State) -> anyhow::Result< } else if m.content() == "look" { let target_pos_vec3 = entity.pos(); let target_pos: BlockPos = target_pos_vec3.into(); - println!("target_pos: {:?}", target_pos); + println!("target_pos: {target_pos:?}"); bot.look_at(&target_pos.center()); } else if m.content() == "jump" { bot.set_jumping(true); @@ -138,10 +138,10 @@ async fn swarm_handle( println!("swarm chat message: {}", m.message().to_ansi()); if m.message().to_string() == " world" { for (name, world) in &swarm.worlds.read().worlds { - println!("world name: {}", name); + println!("world name: {name}"); if let Some(w) = world.upgrade() { for chunk_pos in w.chunk_storage.read().chunks.values() { - println!("chunk: {:?}", chunk_pos); + println!("chunk: {chunk_pos:?}"); } } else { println!("nvm world is gone");