Skip to content

Commit 273ffb8

Browse files
committed
Change match into early expect and print afterwards
1 parent f5c3042 commit 273ffb8

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

examples/flush_rules.rs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,12 @@ fn main() {
1313
let mut pf = PfCtl::new().expect("Unable to connect to PF");
1414

1515
for anchor_name in env::args().skip(1) {
16-
match pf.flush_rules(&anchor_name, pfctl::RulesetKind::Filter) {
17-
Ok(_) => println!("Flushed filter rules under anchor {}", anchor_name),
18-
err => err.expect("Unable to flush filter rules"),
19-
}
20-
match pf.flush_rules(&anchor_name, pfctl::RulesetKind::Redirect) {
21-
Ok(_) => println!("Flushed redirect rules under anchor {}", anchor_name),
22-
err => err.expect("Unable to flush redirect rules"),
23-
}
16+
pf.flush_rules(&anchor_name, pfctl::RulesetKind::Filter)
17+
.expect("Unable to flush filter rules");
18+
println!("Flushed filter rules under anchor {}", anchor_name);
19+
20+
pf.flush_rules(&anchor_name, pfctl::RulesetKind::Redirect)
21+
.expect("Unable to flush redirect rules");
22+
println!("Flushed redirect rules under anchor {}", anchor_name);
2423
}
2524
}

0 commit comments

Comments
 (0)