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

@@ -96,28 +96,28 @@ impl NetworkInfo {
return Err(StructureExtraction("network name is invalid!").into());
}
if let Some(n) = &self.title {
if n.contains('\n') {
return Err(StructureExtraction("Network title contain newline char!").into());
}
if let Some(n) = &self.title
&& n.contains('\n')
{
return Err(StructureExtraction("Network title contain newline char!").into());
}
if let Some(dev) = &self.device {
if !regex!("^[a-zA-Z0-9]+$").is_match(dev) {
return Err(StructureExtraction("Network device name is invalid!").into());
}
if let Some(dev) = &self.device
&& !regex!("^[a-zA-Z0-9]+$").is_match(dev)
{
return Err(StructureExtraction("Network device name is invalid!").into());
}
if let Some(bridge) = &self.bridge_name {
if !regex!("^[a-zA-Z0-9]+$").is_match(bridge) {
return Err(StructureExtraction("Network bridge name is invalid!").into());
}
if let Some(bridge) = &self.bridge_name
&& !regex!("^[a-zA-Z0-9]+$").is_match(bridge)
{
return Err(StructureExtraction("Network bridge name is invalid!").into());
}
if let Some(domain) = &self.domain {
if !regex!("^[a-zA-Z0-9.]+$").is_match(domain) {
return Err(StructureExtraction("Domain name is invalid!").into());
}
if let Some(domain) = &self.domain
&& !regex!("^[a-zA-Z0-9.]+$").is_match(domain)
{
return Err(StructureExtraction("Domain name is invalid!").into());
}
let mut ips = Vec::with_capacity(2);
@@ -303,16 +303,16 @@ impl NetworkInfo {
/// Check if at least one NAT definition was specified on this interface
pub fn has_nat_def(&self) -> bool {
if let Some(ipv4) = &self.ip_v4 {
if ipv4.nat.is_some() {
return true;
}
if let Some(ipv4) = &self.ip_v4
&& ipv4.nat.is_some()
{
return true;
}
if let Some(ipv6) = &self.ip_v6 {
if ipv6.nat.is_some() {
return true;
}
if let Some(ipv6) = &self.ip_v6
&& ipv6.nat.is_some()
{
return true;
}
false