Skip to content

Commit fa609bd

Browse files
christian-schillingLMG
authored andcommitted
Add simplification rules for message filter
Change: simplify-message-opt
1 parent 951173b commit fa609bd

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

josh-core/src/filter/opt.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -445,6 +445,7 @@ fn step(filter: Filter) -> Filter {
445445
Op::Subtract(a, b) if a == b => Op::Empty,
446446
Op::Subtract(af, bf) => match (to_op(af), to_op(bf)) {
447447
(Op::Empty, _) => Op::Empty,
448+
(Op::Message(..), Op::Message(..)) => Op::Empty,
448449
(_, Op::Nop) => Op::Empty,
449450
(a, Op::Empty) => a,
450451
(Op::Chain(a, b), Op::Chain(c, d)) if a == c => {
@@ -492,6 +493,7 @@ fn step(filter: Filter) -> Filter {
492493
pub fn invert(filter: Filter) -> JoshResult<Filter> {
493494
let result = match to_op(filter) {
494495
Op::Nop => Some(Op::Nop),
496+
Op::Message(..) => Some(Op::Nop),
495497
Op::Linear => Some(Op::Nop),
496498
Op::Prune => Some(Op::Prune),
497499
Op::Unsign => Some(Op::Unsign),

0 commit comments

Comments
 (0)