aboutsummaryrefslogtreecommitdiff
path: root/azalea-brigadier/src/context/command_context_builder.rs
diff options
context:
space:
mode:
authormat <git@matdoes.dev>2025-02-22 23:01:54 +0000
committermat <git@matdoes.dev>2025-02-22 23:01:54 +0000
commit34f53baf85fb5c7163ec5d71a8ab9d45d3f271b6 (patch)
tree7920fec1203e8e96463a142f5f6da6164e76e684 /azalea-brigadier/src/context/command_context_builder.rs
parentbdd2fc91e11e2896d8e1c7046df247e1075bd40d (diff)
downloadazalea-drasl-34f53baf85fb5c7163ec5d71a8ab9d45d3f271b6.tar.xz
update to rust edition 2024
Diffstat (limited to 'azalea-brigadier/src/context/command_context_builder.rs')
-rwxr-xr-xazalea-brigadier/src/context/command_context_builder.rs28
1 files changed, 14 insertions, 14 deletions
diff --git a/azalea-brigadier/src/context/command_context_builder.rs b/azalea-brigadier/src/context/command_context_builder.rs
index 3fb8ec70..87427bc1 100755
--- a/azalea-brigadier/src/context/command_context_builder.rs
+++ b/azalea-brigadier/src/context/command_context_builder.rs
@@ -3,8 +3,8 @@ use std::{collections::HashMap, fmt::Debug, rc::Rc, sync::Arc};
use parking_lot::RwLock;
use super::{
- command_context::CommandContext, parsed_command_node::ParsedCommandNode,
- string_range::StringRange, suggestion_context::SuggestionContext, ParsedArgument,
+ ParsedArgument, command_context::CommandContext, parsed_command_node::ParsedCommandNode,
+ string_range::StringRange, suggestion_context::SuggestionContext,
};
use crate::{
command_dispatcher::CommandDispatcher,
@@ -107,18 +107,18 @@ impl<'a, S> CommandContextBuilder<'a, S> {
}
if self.range.end() < cursor {
- if let Some(child) = &self.child {
- child.find_suggestion_context(cursor)
- } else if let Some(last) = self.nodes.last() {
- SuggestionContext {
- parent: Arc::clone(&last.node),
- start_pos: last.range.end() + 1,
- }
- } else {
- SuggestionContext {
- parent: Arc::clone(&self.root),
- start_pos: self.range.start(),
- }
+ match &self.child {
+ Some(child) => child.find_suggestion_context(cursor),
+ _ => match self.nodes.last() {
+ Some(last) => SuggestionContext {
+ parent: Arc::clone(&last.node),
+ start_pos: last.range.end() + 1,
+ },
+ _ => SuggestionContext {
+ parent: Arc::clone(&self.root),
+ start_pos: self.range.start(),
+ },
+ },
}
} else {
let mut prev = &self.root;