Skip to content

Commit

Permalink
change self modifier to reduce clone()
Browse files Browse the repository at this point in the history
  • Loading branch information
hach1test committed Feb 1, 2024
1 parent 812c56b commit 62028b6
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions src/detections/rule/condition_parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ impl IntoIterator for ConditionToken {
}

impl ConditionToken {
fn replace_subtoken(&self, sub_tokens: Vec<ConditionToken>) -> ConditionToken {
fn replace_subtoken(self, sub_tokens: Vec<ConditionToken>) -> ConditionToken {
match self {
ConditionToken::ParenthesisContainer(_) => {
ConditionToken::ParenthesisContainer(sub_tokens.into_iter())
Expand All @@ -69,15 +69,13 @@ impl ConditionToken {
ConditionToken::OperandContainer(_) => {
ConditionToken::OperandContainer(sub_tokens.into_iter())
}
ConditionToken::LeftParenthesis => ConditionToken::LeftParenthesis,
ConditionToken::RightParenthesis => ConditionToken::RightParenthesis,
ConditionToken::Space => ConditionToken::Space,
ConditionToken::Not => ConditionToken::Not,
ConditionToken::And => ConditionToken::And,
ConditionToken::Or => ConditionToken::Or,
ConditionToken::SelectionReference(name) => {
ConditionToken::SelectionReference(name.clone())
}
ConditionToken::LeftParenthesis => self,
ConditionToken::RightParenthesis => self,
ConditionToken::Space => self,
ConditionToken::Not => self,
ConditionToken::And => self,
ConditionToken::Or => self,
ConditionToken::SelectionReference(_) => self,
}
}

Expand Down

0 comments on commit 62028b6

Please sign in to comment.