]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
rust: fix clippy lints for is_empty in debug code
authorJason Ish <jason.ish@oisf.net>
Fri, 14 Oct 2022 17:38:20 +0000 (11:38 -0600)
committerVictor Julien <vjulien@oisf.net>
Mon, 24 Oct 2022 09:20:10 +0000 (11:20 +0200)
rust/src/dns/lua.rs
rust/src/nfs/nfs.rs

index 57a492f1dae8c66b6a906ee68c444e12327912b0..e0e0803f6f789c46594cb2b81ad74ae7ca5633a9 100644 (file)
@@ -168,7 +168,7 @@ pub extern "C" fn rs_dns_lua_get_answer_table(clua: &mut CLuaState,
             // All rdata types are pushed to "addr" for backwards compatibility
             match answer.data {
                 DNSRData::A(ref bytes) | DNSRData::AAAA(ref bytes) => {
-                    if bytes.len() > 0 {
+                    if !bytes.is_empty() {
                         lua.pushstring("addr");
                         lua.pushstring(&dns_print_addr(&bytes));
                         lua.settable(-3);
@@ -181,14 +181,14 @@ pub extern "C" fn rs_dns_lua_get_answer_table(clua: &mut CLuaState,
                 DNSRData::NULL(ref bytes) |
                 DNSRData::PTR(ref bytes) |
                 DNSRData::Unknown(ref bytes) => {
-                    if bytes.len() > 0 {
+                    if !bytes.is_empty() {
                         lua.pushstring("addr");
                         lua.pushstring(&String::from_utf8_lossy(&bytes));
                         lua.settable(-3);
                     }
                 },
                 DNSRData::SOA(ref soa) => {
-                    if soa.mname.len() > 0 {
+                    if !soa.mname.is_empty() {
                         lua.pushstring("addr");
                         lua.pushstring(&String::from_utf8_lossy(&soa.mname));
                         lua.settable(-3);
index 06bdaa7b70bc89545c9e4f252fa841ca82170891..8adaf3913d2217d999fc04e96b125c60e155e65b 100644 (file)
@@ -1162,7 +1162,7 @@ impl NFSState {
                     Ok((_rem, ref hdr)) => {
                         // we got here because rec_size > input, so we should never have
                         // remaining data
-                        debug_validate_bug_on!(_rem.len() != 0);
+                        debug_validate_bug_on!(!_rem.is_empty());
 
                         match parse_nfs3_request_write(hdr.prog_data, false) {
                             Ok((_, ref w)) => {
@@ -1326,7 +1326,7 @@ impl NFSState {
                     Ok((_rem, ref hdr)) => {
                         // we got here because rec_size > input, so we should never have
                         // remaining data
-                        debug_validate_bug_on!(_rem.len() != 0);
+                        debug_validate_bug_on!(!_rem.is_empty());
 
                         match parse_nfs3_reply_read(hdr.prog_data, false) {
                             Ok((_, ref r)) => {