aboutsummaryrefslogtreecommitdiff
path: root/azalea
diff options
context:
space:
mode:
authormat <git@matdoes.dev>2025-05-30 19:36:59 -0800
committermat <git@matdoes.dev>2025-05-30 19:36:59 -0800
commitae4b1e85e669bc882d158509ef1eda46c6b2a72e (patch)
treeadf81cc01b0ce1575e95b99ad109fd92db1738f6 /azalea
parenta64c6505049082175224802c5be51ac8f0cf4677 (diff)
downloadazalea-drasl-ae4b1e85e669bc882d158509ef1eda46c6b2a72e.tar.xz
fix clippy issues and improve formatting everywhere
Diffstat (limited to 'azalea')
-rw-r--r--azalea/examples/echo.rs15
-rw-r--r--azalea/examples/testbot/commands/debug.rs4
-rw-r--r--azalea/src/container.rs6
-rw-r--r--azalea/src/pathfinder/astar.rs4
-rw-r--r--azalea/src/pathfinder/mod.rs3
-rw-r--r--azalea/src/pathfinder/moves/mod.rs7
6 files changed, 22 insertions, 17 deletions
diff --git a/azalea/examples/echo.rs b/azalea/examples/echo.rs
index 1e773b7d..80b0cb15 100644
--- a/azalea/examples/echo.rs
+++ b/azalea/examples/echo.rs
@@ -18,13 +18,14 @@ async fn main() {
pub struct State {}
async fn handle(bot: Client, event: Event, _state: State) -> anyhow::Result<()> {
- if let Event::Chat(m) = event {
- if let (Some(sender), content) = m.split_sender_and_content() {
- if sender == bot.username() {
- return Ok(()); // ignore our own messages
- }
- bot.chat(&content);
- };
+ if let Event::Chat(m) = event
+ && let (Some(sender), content) = m.split_sender_and_content()
+ {
+ if sender == bot.username() {
+ // ignore our own messages
+ return Ok(());
+ }
+ bot.chat(&content);
}
Ok(())
diff --git a/azalea/examples/testbot/commands/debug.rs b/azalea/examples/testbot/commands/debug.rs
index 075348b2..b97ad71d 100644
--- a/azalea/examples/testbot/commands/debug.rs
+++ b/azalea/examples/testbot/commands/debug.rs
@@ -1,6 +1,6 @@
//! Commands for debugging and getting the current state of the bot.
-use std::{env, fs::File, io::Write, thread, time::Duration};
+use std::{env, fs::File, io::Write, process, thread, time::Duration};
use azalea::{
BlockPos,
@@ -288,7 +288,7 @@ pub fn register(commands: &mut CommandDispatcher<Mutex<CommandSource>>) {
thread::spawn(move || {
thread::sleep(Duration::from_secs(1));
- std::process::exit(0);
+ process::exit(0);
});
1
diff --git a/azalea/src/container.rs b/azalea/src/container.rs
index 0d1cfb16..ebc033f3 100644
--- a/azalea/src/container.rs
+++ b/azalea/src/container.rs
@@ -1,5 +1,5 @@
+use std::fmt;
use std::fmt::Debug;
-use std::fmt::Formatter;
use azalea_client::packet::game::ReceiveGamePacketEvent;
use azalea_client::{
@@ -121,7 +121,7 @@ pub struct ContainerHandleRef {
client: Client,
}
impl Debug for ContainerHandleRef {
- fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("ContainerHandle")
.field("id", &self.id())
.finish()
@@ -192,7 +192,7 @@ impl Drop for ContainerHandle {
}
}
impl Debug for ContainerHandle {
- fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("ContainerHandle")
.field("id", &self.id())
.finish()
diff --git a/azalea/src/pathfinder/astar.rs b/azalea/src/pathfinder/astar.rs
index feddb57b..e33001e7 100644
--- a/azalea/src/pathfinder/astar.rs
+++ b/azalea/src/pathfinder/astar.rs
@@ -1,7 +1,7 @@
use std::{
cmp::{self},
collections::BinaryHeap,
- fmt::Debug,
+ fmt::{self, Debug},
hash::{BuildHasherDefault, Hash},
time::{Duration, Instant},
};
@@ -251,7 +251,7 @@ pub struct Movement<P: Hash + Copy, M> {
}
impl<P: Hash + Copy + Debug, M: Debug> Debug for Movement<P, M> {
- fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("Movement")
.field("target", &self.target)
.field("data", &self.data)
diff --git a/azalea/src/pathfinder/mod.rs b/azalea/src/pathfinder/mod.rs
index afb1cc4d..58c3736c 100644
--- a/azalea/src/pathfinder/mod.rs
+++ b/azalea/src/pathfinder/mod.rs
@@ -1189,6 +1189,7 @@ mod tests {
use std::{
collections::HashSet,
sync::Arc,
+ thread,
time::{Duration, Instant},
};
@@ -1270,7 +1271,7 @@ mod tests {
&& start_time.elapsed() < Duration::from_millis(500)
{
simulation.tick();
- std::thread::yield_now();
+ thread::yield_now();
}
}
diff --git a/azalea/src/pathfinder/moves/mod.rs b/azalea/src/pathfinder/moves/mod.rs
index 24dc8ac1..88bae957 100644
--- a/azalea/src/pathfinder/moves/mod.rs
+++ b/azalea/src/pathfinder/moves/mod.rs
@@ -1,7 +1,10 @@
pub mod basic;
pub mod parkour;
-use std::{fmt::Debug, sync::Arc};
+use std::{
+ fmt::{self, Debug},
+ sync::Arc,
+};
use azalea_block::BlockState;
use azalea_client::{
@@ -40,7 +43,7 @@ pub struct MoveData {
pub is_reached: &'static (dyn Fn(IsReachedCtx) -> bool + Send + Sync),
}
impl Debug for MoveData {
- fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("MoveData")
// .field("move_kind", &self.move_kind)
.finish()