]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
rust(lint): fix some usages of references
authorJason Ish <jason.ish@oisf.net>
Fri, 20 Aug 2021 17:31:03 +0000 (11:31 -0600)
committerVictor Julien <victor@inliniac.net>
Mon, 23 Aug 2021 08:03:12 +0000 (10:03 +0200)
- ref is discouraged for top level variables
- the other borrow is not required

rust/src/dns/log.rs
rust/src/rdp/util.rs

index 22ffefa5218da5af6778d8ffc3d733168a5c144f..5c379ff1405b495c5047822c0f323a431137c8d5 100644 (file)
@@ -742,7 +742,7 @@ fn dns_log_json_failure_v1(r: &DNSResponse, index: usize, flags: u64)
         return Ok(None);
     }
 
-    let ref query = r.queries[index];
+    let query = &r.queries[index];
 
     if !dns_log_rrtype_enabled(query.rrtype, flags) {
         return Ok(None);
index 520c3c199d3a806a76e1df7c4c036d6a1fcf566b..dfcb8267d25ce57530be3cce225be33f0d7038e7 100644 (file)
@@ -53,7 +53,7 @@ pub fn le_slice_to_string(input: &[u8]) -> Result<String, Box<dyn std::error::Er
 pub fn utf7_slice_to_string(input: &[u8]) -> Result<String, Box<dyn std::error::Error>> {
     let s = match memchr(b'\0', input) {
         Some(end) => &input[..end],
-        None => &input[..],
+        None => input,
     };
     match std::str::from_utf8(s) {
         Ok(s) => Ok(String::from(s)),