Fix cargo clippy issues
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
2025-08-28 08:05:22 +02:00
parent cd4b8af445
commit a1e23efd99
8 changed files with 110 additions and 114 deletions

View File

@@ -60,10 +60,10 @@ pub struct Nat<IPv> {
impl<IPv> Nat<IPv> {
pub fn check(&self) -> anyhow::Result<()> {
if let NatSourceIP::Interface { name } = &self.host_ip {
if !net_utils::is_net_interface_name_valid(name) {
return Err(NatDefError::InvalidNatDef("Invalid nat interface name!").into());
}
if let NatSourceIP::Interface { name } = &self.host_ip
&& !net_utils::is_net_interface_name_valid(name)
{
return Err(NatDefError::InvalidNatDef("Invalid nat interface name!").into());
}
if let NatHostPort::Range { start, end } = &self.host_port {
@@ -84,10 +84,10 @@ impl<IPv> Nat<IPv> {
return Err(NatDefError::InvalidNatDef("Invalid guest port!").into());
}
if let Some(comment) = &self.comment {
if comment.len() > constants::NET_NAT_COMMENT_MAX_SIZE {
return Err(NatDefError::InvalidNatDef("Comment is too large!").into());
}
if let Some(comment) = &self.comment
&& comment.len() > constants::NET_NAT_COMMENT_MAX_SIZE
{
return Err(NatDefError::InvalidNatDef("Comment is too large!").into());
}
Ok(())