Skip to content

Commit

Permalink
chore: apply new clippy lints
Browse files Browse the repository at this point in the history
  • Loading branch information
pitkley committed Sep 13, 2023
1 parent d6edba9 commit 663a4e1
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 17 deletions.
2 changes: 1 addition & 1 deletion src/bin/dfw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
2 changes: 1 addition & 1 deletion src/iptables/process.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
2 changes: 1 addition & 1 deletion src/nftables/process.rs
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ impl Process<Nftables> for <Nftables as FirewallBackend>::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();
Expand Down
18 changes: 4 additions & 14 deletions src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -808,11 +808,12 @@ fn default_expose_port_family() -> String {
///
/// Parts of the documentation have been taken from
/// <https://wiki.nftables.org/wiki-nftables/index.php/Configuring_chains>.
#[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,
Expand All @@ -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,
Expand All @@ -846,11 +841,12 @@ impl slog::Value for ChainPolicy {
///
/// Parts of the documentation have been taken from
/// <https://wiki.nftables.org/wiki-nftables/index.php/Configuring_chains>.
#[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,
Expand All @@ -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,
Expand Down

0 comments on commit 663a4e1

Please sign in to comment.