]> git.ipfire.org Git - thirdparty/suricata.git/commit
rust/conf: collapse match pattern into if
authorJason Ish <jason.ish@oisf.net>
Tue, 6 Aug 2024 16:43:19 +0000 (10:43 -0600)
committerVictor Julien <victor@inliniac.net>
Wed, 7 Aug 2024 06:31:26 +0000 (08:31 +0200)
commit5ce35f581ac07b37537093ebdd0f781dbad2a59a
treeb6842db9db7d98413cccb51fad70558ede30d5bb
parent2c92b12e19046fd0f18037a377aa2761dfe531e2
rust/conf: collapse match pattern into if

Fixes clippy lint for collapsible_match.

error: this `match` can be collapsed into the outer `if let`
  --> src/conf.rs:85:9
   |
85 | /         match val {
86 | |             "1" | "yes" | "true" | "on" => {
87 | |                 return true;
88 | |             },
89 | |             _ => {},
90 | |         }
   | |_________^
   |
help: the outer pattern can be modified to include the inner pattern
  --> src/conf.rs:84:17
   |
84 |     if let Some(val) = conf_get(key) {
   |                 ^^^ replace this binding
85 |         match val {
86 |             "1" | "yes" | "true" | "on" => {
   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^ with this pattern
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_match
rust/src/conf.rs