From: Jason Ish Date: Fri, 20 Aug 2021 17:38:31 +0000 (-0600) Subject: rust(lint): map the error instead of using or_else X-Git-Tag: suricata-7.0.0-beta1~1514 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b021726a0d3c5b6c3c2726ef61359dca35c37fdf;p=thirdparty%2Fsuricata.git rust(lint): map the error instead of using or_else This is the preffered style and easier to understand the meaning of the code. --- diff --git a/rust/src/dns/detect.rs b/rust/src/dns/detect.rs index 326e9c38a7..b389d2c57f 100644 --- a/rust/src/dns/detect.rs +++ b/rust/src/dns/detect.rs @@ -42,7 +42,7 @@ fn parse_opcode(opcode: &str) -> Result { negated = true; } _ => { - let code: u8 = (&opcode[i..]).parse().or_else(|_| Err(()))?; + let code: u8 = (&opcode[i..]).parse().map_err(|_| ())?; return Ok(DetectDnsOpcode { negate: negated, opcode: code,