Skip to content

Commit

Permalink
Change match into early expect and print afterwards
Browse files Browse the repository at this point in the history
  • Loading branch information
faern committed Jun 12, 2024
1 parent 95e9fcf commit 16449a3
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions examples/flush_rules.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,12 @@ fn main() {
let mut pf = PfCtl::new().expect("Unable to connect to PF");

for anchor_name in env::args().skip(1) {
match pf.flush_rules(&anchor_name, pfctl::RulesetKind::Filter) {
Ok(_) => println!("Flushed filter rules under anchor {}", anchor_name),
err => err.expect("Unable to flush filter rules"),
}
match pf.flush_rules(&anchor_name, pfctl::RulesetKind::Redirect) {
Ok(_) => println!("Flushed redirect rules under anchor {}", anchor_name),
err => err.expect("Unable to flush redirect rules"),
}
pf.flush_rules(&anchor_name, pfctl::RulesetKind::Filter)
.expect("Unable to flush filter rules");
println!("Flushed filter rules under anchor {}", anchor_name);

pf.flush_rules(&anchor_name, pfctl::RulesetKind::Redirect)
.expect("Unable to flush redirect rules");
println!("Flushed redirect rules under anchor {}", anchor_name);
}
}

0 comments on commit 16449a3

Please sign in to comment.