]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
rust: fix clippy warning manual_contains 12938/head
authorPhilippe Antoine <pantoine@oisf.net>
Thu, 3 Apr 2025 11:43:29 +0000 (13:43 +0200)
committerVictor Julien <victor@inliniac.net>
Fri, 4 Apr 2025 00:35:16 +0000 (02:35 +0200)
warning: using `contains()` instead of `iter().any()` is more efficient
   --> src/http2/http2.rs:267:20
    |
267 |                 if block.value.iter().any(|&x| x == b'@') {
    |                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `block.value.contains(&b'@')`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_contains
    = note: `#[warn(clippy::manual_contains)]` on by default

rust/src/http2/http2.rs

index eac3c884828b904f84c5fca5828f2ffd37a9fcdd..ddc93940dc058f9c6b43676693e5b3fd1bbde20b 100644 (file)
@@ -264,7 +264,7 @@ impl HTTP2Transaction {
                 path = Some(&block.value);
             } else if block.name.eq_ignore_ascii_case(b":authority") {
                 authority = Some(&block.value);
-                if block.value.iter().any(|&x| x == b'@') {
+                if block.value.contains(&b'@') {
                     // it is forbidden by RFC 9113 to have userinfo in this field
                     // when in HTTP1 we can have user:password@domain.com
                     self.set_event(HTTP2Event::UserinfoInUri);