diff --git a/examples/add_anchor.rs b/examples/add_anchor.rs index 55dcbe9..aaf9238 100644 --- a/examples/add_anchor.rs +++ b/examples/add_anchor.rs @@ -20,6 +20,6 @@ fn main() { pf.try_add_anchor(&anchor_name, pfctl::AnchorKind::Scrub) .expect("Unable to add scrub anchor"); - println!("Added {} as every anchor type", anchor_name); + println!("Added {anchor_name} as every anchor type"); } } diff --git a/examples/add_rules.rs b/examples/add_rules.rs index 54d8373..f1dee2f 100644 --- a/examples/add_rules.rs +++ b/examples/add_rules.rs @@ -114,7 +114,7 @@ fn main() { pf.add_scrub_rule(ANCHOR_NAME, &scrub_rule) .expect("Unable to add scrub rule"); - println!("Added a bunch of rules to the {} anchor.", ANCHOR_NAME); + println!("Added a bunch of rules to the {ANCHOR_NAME} anchor."); println!("Run this command to remove them:"); - println!("sudo pfctl -a {} -F all", ANCHOR_NAME); + println!("sudo pfctl -a {ANCHOR_NAME} -F all"); } diff --git a/examples/flush_rules.rs b/examples/flush_rules.rs index c67150f..ae64076 100644 --- a/examples/flush_rules.rs +++ b/examples/flush_rules.rs @@ -15,18 +15,18 @@ fn main() { for anchor_name in env::args().skip(1) { pf.flush_rules(&anchor_name, pfctl::RulesetKind::Filter) .expect("Unable to flush filter rules"); - println!("Flushed filter rules under anchor {}", anchor_name); + println!("Flushed filter rules under anchor {anchor_name}"); pf.flush_rules(&anchor_name, pfctl::RulesetKind::Nat) .expect("Unable to flush nat rules"); - println!("Flushed nat rules under anchor {}", anchor_name); + println!("Flushed nat 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); + println!("Flushed redirect rules under anchor {anchor_name}"); pf.flush_rules(&anchor_name, pfctl::RulesetKind::Scrub) .expect("Unable to flush scrub rules"); - println!("Flushed scrub rules under anchor {}", anchor_name); + println!("Flushed scrub rules under anchor {anchor_name}"); } } diff --git a/examples/transaction.rs b/examples/transaction.rs index f8e7ec0..704da68 100644 --- a/examples/transaction.rs +++ b/examples/transaction.rs @@ -54,7 +54,7 @@ fn main() { pf.set_rules(ANCHOR_NAME, trans_change) .expect("Unable to set rules"); - println!("Added a bunch of rules to the {} anchor.", ANCHOR_NAME); + println!("Added a bunch of rules to the {ANCHOR_NAME} anchor."); println!("Run this command to remove them:"); - println!("sudo pfctl -a {} -F all", ANCHOR_NAME); + println!("sudo pfctl -a {ANCHOR_NAME} -F all"); } diff --git a/src/rule/mod.rs b/src/rule/mod.rs index f57871f..8141a92 100644 --- a/src/rule/mod.rs +++ b/src/rule/mod.rs @@ -119,10 +119,8 @@ impl FilterRule { | (StatePolicy::Modulate, Proto::Tcp) | (StatePolicy::SynProxy, Proto::Tcp) => Ok(self.keep_state), (state_policy, proto) => { - let msg = format!( - "StatePolicy {:?} and protocol {:?} are incompatible", - state_policy, proto - ); + let msg = + format!("StatePolicy {state_policy:?} and protocol {proto:?} are incompatible"); Err(Error::from(ErrorInternal::InvalidRuleCombination(msg))) } } @@ -360,7 +358,7 @@ fn compatible_af(af1: AddrFamily, af2: AddrFamily) -> Result { (af, AddrFamily::Any) => Ok(af), (AddrFamily::Any, af) => Ok(af), (af1, af2) => { - let msg = format!("AddrFamily {} and {} are incompatible", af1, af2); + let msg = format!("AddrFamily {af1} and {af2} are incompatible"); Err(Error::from(ErrorInternal::InvalidRuleCombination(msg))) } }