]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
rust/dcerpc: clippy fix for match
authorJason Ish <jason.ish@oisf.net>
Tue, 6 Aug 2024 16:30:13 +0000 (10:30 -0600)
committerVictor Julien <victor@inliniac.net>
Wed, 7 Aug 2024 06:31:26 +0000 (08:31 +0200)
error: this `match` can be collapsed into the outer `match`
   --> src/dcerpc/detect.rs:215:20
    |
215 |           Some(x) => match x {
    |  ____________________^
216 | |             DCERPC_TYPE_REQUEST | DCERPC_TYPE_RESPONSE => {}
217 | |             _ => {
218 | |                 return 0;
219 | |             }
220 | |         },
    | |_________^
    |
help: the outer pattern can be modified to include the inner pattern
   --> src/dcerpc/detect.rs:215:14
    |
215 |         Some(x) => match x {
    |              ^ replace this binding
216 |             DCERPC_TYPE_REQUEST | DCERPC_TYPE_RESPONSE => {}
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ with this pattern
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_match

rust/src/dcerpc/detect.rs

index 81f2854ace6d79ab48cdf677025d9b38deb88218..2a0209c80cc663e3e3707d23f0e60909b1ed7157 100644 (file)
@@ -212,13 +212,8 @@ pub extern "C" fn rs_dcerpc_iface_match(
     }
 
     match state.get_hdr_type() {
-        Some(x) => match x {
-            DCERPC_TYPE_REQUEST | DCERPC_TYPE_RESPONSE => {}
-            _ => {
-                return 0;
-            }
-        },
-        None => {
+        Some(DCERPC_TYPE_REQUEST | DCERPC_TYPE_RESPONSE) => {}
+        _ => {
             return 0;
         }
     };