aboutsummaryrefslogtreecommitdiff
path: root/azalea-brigadier/src/context
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-brigadier/src/context
parenta64c6505049082175224802c5be51ac8f0cf4677 (diff)
downloadazalea-drasl-ae4b1e85e669bc882d158509ef1eda46c6b2a72e.tar.xz
fix clippy issues and improve formatting everywhere
Diffstat (limited to 'azalea-brigadier/src/context')
-rw-r--r--azalea-brigadier/src/context/command_context.rs10
-rw-r--r--azalea-brigadier/src/context/command_context_builder.rs9
-rw-r--r--azalea-brigadier/src/context/context_chain.rs4
3 files changed, 16 insertions, 7 deletions
diff --git a/azalea-brigadier/src/context/command_context.rs b/azalea-brigadier/src/context/command_context.rs
index d50c94ab..a9959895 100644
--- a/azalea-brigadier/src/context/command_context.rs
+++ b/azalea-brigadier/src/context/command_context.rs
@@ -1,4 +1,10 @@
-use std::{any::Any, collections::HashMap, fmt::Debug, rc::Rc, sync::Arc};
+use std::{
+ any::Any,
+ collections::HashMap,
+ fmt::{self, Debug},
+ rc::Rc,
+ sync::Arc,
+};
use parking_lot::RwLock;
@@ -40,7 +46,7 @@ impl<S> Clone for CommandContext<S> {
}
impl<S> Debug for CommandContext<S> {
- fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("CommandContext")
// .field("source", &self.source)
.field("input", &self.input)
diff --git a/azalea-brigadier/src/context/command_context_builder.rs b/azalea-brigadier/src/context/command_context_builder.rs
index 87427bc1..f8d4334d 100644
--- a/azalea-brigadier/src/context/command_context_builder.rs
+++ b/azalea-brigadier/src/context/command_context_builder.rs
@@ -1,4 +1,9 @@
-use std::{collections::HashMap, fmt::Debug, rc::Rc, sync::Arc};
+use std::{
+ collections::HashMap,
+ fmt::{self, Debug},
+ rc::Rc,
+ sync::Arc,
+};
use parking_lot::RwLock;
@@ -140,7 +145,7 @@ impl<'a, S> CommandContextBuilder<'a, S> {
}
impl<S> Debug for CommandContextBuilder<'_, S> {
- fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("CommandContextBuilder")
// .field("arguments", &self.arguments)
.field("root", &self.root)
diff --git a/azalea-brigadier/src/context/context_chain.rs b/azalea-brigadier/src/context/context_chain.rs
index 74fe6e01..afafe957 100644
--- a/azalea-brigadier/src/context/context_chain.rs
+++ b/azalea-brigadier/src/context/context_chain.rs
@@ -28,9 +28,7 @@ impl<S> ContextChain<S> {
let child = current.child.clone();
let Some(child) = child else {
// Last entry must be executable command
- if current.command.is_none() {
- return None;
- }
+ current.command.as_ref()?;
return Some(ContextChain::new(modifiers, current));
};