mirror of
https://github.com/mat-1/azalea.git
synced 2025-08-02 06:16:04 +00:00
fix issues with clippy
This commit is contained in:
parent
bd83459bb1
commit
e2c6131ac9
5 changed files with 12 additions and 19 deletions
|
@ -1,10 +1,7 @@
|
|||
use crate::{
|
||||
context::CommandContext, exceptions::command_syntax_exception::CommandSyntaxException,
|
||||
modifier::RedirectModifier, tree::CommandNode,
|
||||
};
|
||||
use crate::{context::CommandContext, modifier::RedirectModifier, tree::CommandNode};
|
||||
|
||||
use super::{literal_argument_builder::Literal, required_argument_builder::Argument};
|
||||
use std::{any::Any, cell::RefCell, fmt::Debug, rc::Rc};
|
||||
use std::{cell::RefCell, fmt::Debug, rc::Rc};
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub enum ArgumentBuilderType {
|
||||
|
@ -31,7 +28,7 @@ impl<S> Clone for ArgumentBuilder<S> {
|
|||
command: self.command.clone(),
|
||||
requirement: self.requirement.clone(),
|
||||
target: self.target.clone(),
|
||||
forks: self.forks.clone(),
|
||||
forks: self.forks,
|
||||
modifier: self.modifier.clone(),
|
||||
}
|
||||
}
|
||||
|
@ -118,7 +115,7 @@ impl<S> ArgumentBuilder<S> {
|
|||
literals: Default::default(),
|
||||
};
|
||||
|
||||
for (_, argument) in &self.arguments.children {
|
||||
for argument in self.arguments.children.values() {
|
||||
result.add_child(argument);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
use std::any::Any;
|
||||
|
||||
use super::argument_builder::{ArgumentBuilder, ArgumentBuilderType};
|
||||
|
||||
#[derive(Debug, Clone, Default)]
|
||||
|
|
|
@ -32,7 +32,7 @@ impl<S> Clone for CommandContextBuilder<S> {
|
|||
child: self.child.clone(),
|
||||
range: self.range.clone(),
|
||||
modifier: self.modifier.clone(),
|
||||
forks: self.forks.clone(),
|
||||
forks: self.forks,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -150,7 +150,7 @@ impl<S> Clone for CommandContext<S> {
|
|||
range: self.range.clone(),
|
||||
child: self.child.clone(),
|
||||
modifier: self.modifier.clone(),
|
||||
forks: self.forks.clone(),
|
||||
forks: self.forks,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,9 +8,7 @@ use crate::{
|
|||
string_reader::StringReader,
|
||||
tree::CommandNode,
|
||||
};
|
||||
use std::{
|
||||
any::Any, cell::RefCell, cmp::Ordering, collections::HashMap, marker::PhantomData, mem, rc::Rc,
|
||||
};
|
||||
use std::{cell::RefCell, cmp::Ordering, collections::HashMap, marker::PhantomData, mem, rc::Rc};
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct CommandDispatcher<S> {
|
||||
|
@ -96,7 +94,7 @@ impl<S> CommandDispatcher<S> {
|
|||
if let Some(redirect) = &child.borrow().redirect {
|
||||
let child_context = CommandContextBuilder::new(
|
||||
Rc::new(self.clone()),
|
||||
source.clone(),
|
||||
source,
|
||||
redirect.clone(),
|
||||
reader.cursor,
|
||||
);
|
||||
|
@ -168,7 +166,7 @@ impl<S> CommandDispatcher<S> {
|
|||
result: &mut Vec<Vec<Rc<RefCell<CommandNode<S>>>>>,
|
||||
parents: Vec<Rc<RefCell<CommandNode<S>>>>,
|
||||
) {
|
||||
let mut current = parents.clone();
|
||||
let mut current = parents;
|
||||
current.push(node.clone());
|
||||
result.push(current.clone());
|
||||
|
||||
|
@ -178,7 +176,7 @@ impl<S> CommandDispatcher<S> {
|
|||
}
|
||||
|
||||
pub fn get_path(&self, target: CommandNode<S>) -> Vec<String> {
|
||||
let rc_target = Rc::new(RefCell::new(target.clone()));
|
||||
let rc_target = Rc::new(RefCell::new(target));
|
||||
let mut nodes: Vec<Vec<Rc<RefCell<CommandNode<S>>>>> = Vec::new();
|
||||
self.add_paths(self.root.clone(), &mut nodes, vec![]);
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ use crate::{
|
|||
string_range::StringRange,
|
||||
string_reader::StringReader,
|
||||
};
|
||||
use std::{any::Any, cell::RefCell, collections::BTreeMap, fmt::Debug, hash::Hash, ptr, rc::Rc};
|
||||
use std::{cell::RefCell, collections::BTreeMap, fmt::Debug, hash::Hash, ptr, rc::Rc};
|
||||
|
||||
/// An ArgumentBuilder that has been built.
|
||||
#[non_exhaustive]
|
||||
|
@ -40,7 +40,7 @@ impl<S> Clone for CommandNode<S> {
|
|||
command: self.command.clone(),
|
||||
requirement: self.requirement.clone(),
|
||||
redirect: self.redirect.clone(),
|
||||
forks: self.forks.clone(),
|
||||
forks: self.forks,
|
||||
modifier: self.modifier.clone(),
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue