diff --git a/src/bin/dfw.rs b/src/bin/dfw.rs index 9ed2fc63..7cd47e8b 100644 --- a/src/bin/dfw.rs +++ b/src/bin/dfw.rs @@ -478,7 +478,7 @@ fn main() { // Signals should be set up as early as possible, to set proper signal masks to all threads let (s_signal, r_signal) = crossbeam_channel::bounded(10); let mut signals = - signal_hook::iterator::Signals::new(&[libc::SIGINT, libc::SIGTERM, libc::SIGHUP]) + signal_hook::iterator::Signals::new([libc::SIGINT, libc::SIGTERM, libc::SIGHUP]) .expect("Failed to bind to process signals"); thread::spawn(move || { for signal in signals.forever() { diff --git a/src/iptables/process.rs b/src/iptables/process.rs index 5aa4934b..9b99d7fd 100644 --- a/src/iptables/process.rs +++ b/src/iptables/process.rs @@ -1042,5 +1042,5 @@ fn append_built_rule( rule_discriminant: IptablesRuleDiscriminants, rule: &BuiltRule, ) -> IptablesRule { - append_rule(rule_discriminant, &*rule.table, &*rule.chain, &*rule.rule) + append_rule(rule_discriminant, &rule.table, &rule.chain, &rule.rule) } diff --git a/src/nftables/process.rs b/src/nftables/process.rs index 55774bec..f9a5564e 100644 --- a/src/nftables/process.rs +++ b/src/nftables/process.rs @@ -186,7 +186,7 @@ impl Process for ::Defaults { if let Some(custom_tables) = custom_tables { // Retrieve current ruleset to avoid duplication of already existing rules. let current_ruleset = Command::new("nft") - .args(&["list", "ruleset"]) + .args(["list", "ruleset"]) .output() .map(|output| String::from_utf8_lossy(&output.stdout).into_owned()) .ok(); diff --git a/src/types.rs b/src/types.rs index 88183ce8..fdf2fb86 100644 --- a/src/types.rs +++ b/src/types.rs @@ -808,11 +808,12 @@ fn default_expose_port_family() -> String { /// /// Parts of the documentation have been taken from /// . -#[derive(Deserialize, Debug, Clone, Copy, PartialEq, Eq, Hash, Display, EnumString)] +#[derive(Deserialize, Default, Debug, Clone, Copy, PartialEq, Eq, Hash, Display, EnumString)] #[serde(rename_all = "lowercase")] #[strum(serialize_all = "snake_case")] pub enum ChainPolicy { /// The accept verdict means that the packet will keep traversing the network stack. + #[default] #[strum(to_string = "accept", serialize = "ACCEPT")] #[serde(alias = "ACCEPT")] Accept, @@ -823,12 +824,6 @@ pub enum ChainPolicy { Drop, } -impl Default for ChainPolicy { - fn default() -> ChainPolicy { - ChainPolicy::Accept - } -} - impl slog::Value for ChainPolicy { fn serialize( &self, @@ -846,11 +841,12 @@ impl slog::Value for ChainPolicy { /// /// Parts of the documentation have been taken from /// . -#[derive(Deserialize, Debug, Clone, Copy, PartialEq, Eq, Hash, Display, EnumString)] +#[derive(Deserialize, Default, Debug, Clone, Copy, PartialEq, Eq, Hash, Display, EnumString)] #[serde(rename_all = "lowercase")] #[strum(serialize_all = "snake_case")] pub enum RuleVerdict { /// The accept verdict means that the packet will keep traversing the network stack. + #[default] #[serde(alias = "ACCEPT")] #[strum(to_string = "accept", serialize = "ACCEPT")] Accept, @@ -866,12 +862,6 @@ pub enum RuleVerdict { Reject, } -impl Default for RuleVerdict { - fn default() -> RuleVerdict { - RuleVerdict::Accept - } -} - impl slog::Value for RuleVerdict { fn serialize( &self,