Skip to content

Commit

Permalink
Simplify visit unary op (#408)
Browse files Browse the repository at this point in the history
  • Loading branch information
sourcefrog authored Sep 12, 2024
2 parents da63492 + 9b4cc9d commit 727682a
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions src/visit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Expand Down

0 comments on commit 727682a

Please sign in to comment.