From 6a7439a26b7758a5b4abe82c9ce8437716941985 Mon Sep 17 00:00:00 2001 From: Jason Ish Date: Fri, 14 Oct 2022 11:38:20 -0600 Subject: [PATCH] rust: fix clippy lints for is_empty in debug code --- rust/src/dns/lua.rs | 6 +++--- rust/src/nfs/nfs.rs | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/rust/src/dns/lua.rs b/rust/src/dns/lua.rs index 57a492f1da..e0e0803f6f 100644 --- a/rust/src/dns/lua.rs +++ b/rust/src/dns/lua.rs @@ -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); diff --git a/rust/src/nfs/nfs.rs b/rust/src/nfs/nfs.rs index 06bdaa7b70..8adaf3913d 100644 --- a/rust/src/nfs/nfs.rs +++ b/rust/src/nfs/nfs.rs @@ -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)) => { -- 2.47.2