rust/smb: fix clippy nightly warning

error: unnecessary use of `to_vec`
    --> src/smb/smb.rs:1048:62
     |
1048 |         let (name, is_dcerpc) = match self.guid2name_map.get(&guid.to_vec()) {
     |                                                              ^^^^^^^^^^^^^^ help: replace it with: `guid`
     |
     = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_to_owned
     = note: `#[deny(clippy::unnecessary_to_owned)]` implied by `#[deny(warnings)]`

And also other uses of to_vec() on already Vec
pull/10693/head
Philippe Antoine 1 year ago
parent 02f2fb8833
commit f7cde8f00e

@ -89,7 +89,7 @@ impl DHCPLogger {
js.set_uint("id", header.txid as u64)?;
js.set_string("client_mac",
&format_addr_hex(&header.clienthw.to_vec()))?;
&format_addr_hex(&header.clienthw))?;
js.set_string("assigned_ip", &dns_print_addr(&header.yourip))?;
if self.extended {

@ -1045,7 +1045,7 @@ impl SMBState {
pub fn get_service_for_guid(&self, guid: &[u8]) -> (&'static str, bool)
{
let (name, is_dcerpc) = match self.guid2name_map.get(&guid.to_vec()) {
let (name, is_dcerpc) = match self.guid2name_map.get(guid) {
Some(n) => {
let mut s = n.as_slice();
// skip leading \ if we have it

@ -482,7 +482,7 @@ fn smb1_request_record_one(state: &mut SMBState, r: &SmbRecord, command: u8, and
state.ssn2vec_map.insert(name_key, name_val);
let tx_hdr = SMBCommonHdr::from1(r, SMBHDR_TYPE_GENERICTX);
let tx = state.new_create_tx(&cr.file_name.to_vec(),
let tx = state.new_create_tx(&cr.file_name,
cr.disposition, del, dir, tx_hdr);
tx.vercmd.set_smb1_cmd(command);
SCLogDebug!("TS CREATE TX {} created", tx.id);

Loading…
Cancel
Save