diff options
| author | mat <github@matdoes.dev> | 2022-04-17 15:57:28 -0500 |
|---|---|---|
| committer | mat <github@matdoes.dev> | 2022-04-17 15:57:28 -0500 |
| commit | 2e904225611b66fa72b082e4f5e188b55b333fcd (patch) | |
| tree | 5def0247b2a721ea20eded8ac996d957c591a403 /azalea-brigadier/src/builder | |
| parent | 10cd1733cbba5c637fa0130a0cd7a7ab6e618226 (diff) | |
| download | azalea-drasl-2e904225611b66fa72b082e4f5e188b55b333fcd.tar.xz | |
Fix clippy issues and add a couple tests to dispatcher
Diffstat (limited to 'azalea-brigadier/src/builder')
| -rw-r--r-- | azalea-brigadier/src/builder/argument_builder.rs | 8 | ||||
| -rw-r--r-- | azalea-brigadier/src/builder/literal_argument_builder.rs | 9 | ||||
| -rw-r--r-- | azalea-brigadier/src/builder/required_argument_builder.rs | 7 |
3 files changed, 6 insertions, 18 deletions
diff --git a/azalea-brigadier/src/builder/argument_builder.rs b/azalea-brigadier/src/builder/argument_builder.rs index 17e9d625..6f23457a 100644 --- a/azalea-brigadier/src/builder/argument_builder.rs +++ b/azalea-brigadier/src/builder/argument_builder.rs @@ -41,21 +41,21 @@ impl<S: Any + Clone> ArgumentBuilder<S> { } } - pub fn then(&mut self, node: ArgumentBuilder<S>) -> &mut Self { + pub fn then(&mut self, node: ArgumentBuilder<S>) -> Self { let built_node = node.build(); let name = built_node.name(); let node_reference = Rc::new(RefCell::new(built_node.clone())); self.children .insert(name.to_string(), node_reference.clone()); match &built_node.value { - ArgumentBuilderType::Literal(literal) => { + ArgumentBuilderType::Literal(_) => { self.literals.insert(name.to_string(), node_reference); } - ArgumentBuilderType::Argument(argument) => { + ArgumentBuilderType::Argument(_) => { self.arguments.insert(name.to_string(), node_reference); } } - self + self.clone() } pub fn executes<F>(&mut self, f: F) -> Self diff --git a/azalea-brigadier/src/builder/literal_argument_builder.rs b/azalea-brigadier/src/builder/literal_argument_builder.rs index d8898540..e5e165d8 100644 --- a/azalea-brigadier/src/builder/literal_argument_builder.rs +++ b/azalea-brigadier/src/builder/literal_argument_builder.rs @@ -1,14 +1,5 @@ use std::any::Any; -use crate::{ - context::CommandContextBuilder, - exceptions::{ - builtin_exceptions::BuiltInExceptions, command_syntax_exception::CommandSyntaxException, - }, - string_range::StringRange, - string_reader::StringReader, -}; - use super::argument_builder::{ArgumentBuilder, ArgumentBuilderType}; #[derive(Debug, Clone, Default)] diff --git a/azalea-brigadier/src/builder/required_argument_builder.rs b/azalea-brigadier/src/builder/required_argument_builder.rs index 9cd089de..0eb5d11a 100644 --- a/azalea-brigadier/src/builder/required_argument_builder.rs +++ b/azalea-brigadier/src/builder/required_argument_builder.rs @@ -16,7 +16,7 @@ impl Argument { pub fn new(name: &str, parser: Rc<dyn Parser>) -> Self { Self { name: name.to_string(), - parser: parser, + parser, } } @@ -41,9 +41,6 @@ impl Debug for Argument { } /// Shortcut for creating a new argument builder node. -pub fn argument<'a, S: Any + Clone>( - name: &'a str, - parser: impl Parser + 'static, -) -> ArgumentBuilder<S> { +pub fn argument<S: Any + Clone>(name: &str, parser: impl Parser + 'static) -> ArgumentBuilder<S> { ArgumentBuilder::new(Argument::new(name, Rc::new(parser)).into()) } |
