diff --git a/rust/src/conf.rs b/rust/src/conf.rs index 365926b53f..4976607b45 100644 --- a/rust/src/conf.rs +++ b/rust/src/conf.rs @@ -78,11 +78,7 @@ pub fn conf_get(key: &str) -> Option<&str> { // Return the value of key as a boolean. A value that is not set is // the same as having it set to false. pub fn conf_get_bool(key: &str) -> bool { - if let Some("1" | "yes" | "true" | "on") = conf_get(key) { - return true; - } - - return false; + matches!(conf_get(key), Some("1" | "yes" | "true" | "on")) } /// Wrap a Suricata ConfNode and expose some of its methods with a @@ -161,10 +157,7 @@ impl ConfNode { } } - if vptr == 1 { - return true; - } - return false; + return vptr == 1; } } diff --git a/rust/src/detect/iprep.rs b/rust/src/detect/iprep.rs index ddf9446729..2057fbf0a8 100644 --- a/rust/src/detect/iprep.rs +++ b/rust/src/detect/iprep.rs @@ -70,13 +70,7 @@ pub struct DetectIPRepData { } pub fn is_alphanumeric_or_slash(chr: char) -> bool { - if chr.is_ascii_alphanumeric() { - return true; - } - if chr == '_' || chr == '-' { - return true; - } - return false; + return chr.is_ascii_alphanumeric() || chr == '_' || chr == '-'; } pub fn detect_parse_iprep(i: &str) -> IResult<&str, DetectIPRepData, RuleParseError<&str>> { diff --git a/rust/src/dhcp/logger.rs b/rust/src/dhcp/logger.rs index d2751bf427..1bc11da302 100644 --- a/rust/src/dhcp/logger.rs +++ b/rust/src/dhcp/logger.rs @@ -62,10 +62,7 @@ impl DHCPLogger { pub fn do_log(&self, tx: &DHCPTransaction) -> bool { if !self.extended { - if let Some(DHCP_TYPE_ACK) = self.get_type(tx) { - return true; - } - return false; + return matches!(self.get_type(tx), Some(DHCP_TYPE_ACK)); } return true; } diff --git a/rust/src/ssh/parser.rs b/rust/src/ssh/parser.rs index 06dd5a9f29..26ded8e0b6 100644 --- a/rust/src/ssh/parser.rs +++ b/rust/src/ssh/parser.rs @@ -64,10 +64,7 @@ impl MessageCode { #[inline] fn is_not_lineend(b: u8) -> bool { - if b == 10 || b == 13 { - return false; - } - return true; + return b != 10 && b != 13; } //may leave \r at the end to be removed