From 9b4cc9d97a355db35d6600780c1e4af27bbc09e2 Mon Sep 17 00:00:00 2001 From: Martin Pool Date: Thu, 12 Sep 2024 09:34:17 -0400 Subject: [PATCH] Simplify visit unary op --- src/visit.rs | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/visit.rs b/src/visit.rs index 9c32596e..adfdb385 100644 --- a/src/visit.rs +++ b/src/visit.rs @@ -504,20 +504,17 @@ impl<'ast> Visit<'ast> for DiscoveryVisitor<'_> { if attrs_excluded(&i.attrs) { return; } - let replacements = match i.op { - UnOp::Not(_) => vec![quote! {}], - UnOp::Neg(_) => vec![quote! {}], + match i.op { + UnOp::Not(_) | UnOp::Neg(_) => { + self.collect_mutant(i.op.span().into(), quote! {}, Genre::UnaryOperator); + } _ => { trace!( op = i.op.to_pretty_string(), "No mutants generated for this unary operator" ); - Vec::new() } }; - replacements - .into_iter() - .for_each(|rep| self.collect_mutant(i.op.span().into(), rep, Genre::UnaryOperator)); syn::visit::visit_expr_unary(self, i); } }