rust/dcerpc: fix single_match clippy warning

warning: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
  --> src/dcerpc/log.rs:36:33
   |
36 |               DCERPC_TYPE_BIND => match &state.bind {
   |  _________________________________^
37 | |                 Some(bind) => {
38 | |                     jsb.open_array("interfaces")?;
39 | |                     for uuid in &bind.uuid_list {
...  |
51 | |                 None => {}
52 | |             },
   | |_____________^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_match
   = note: `#[warn(clippy::single_match)]` on by default
pull/11755/head
Philippe Antoine 1 month ago committed by Victor Julien
parent 89d229c76f
commit 2a984e3b13

@ -33,22 +33,19 @@ fn log_dcerpc_header_tcp(
jsb.set_uint("stub_data_size", tx.stub_data_buffer_ts.len() as u64)?;
jsb.close()?;
}
DCERPC_TYPE_BIND => match &state.bind {
Some(bind) => {
jsb.open_array("interfaces")?;
for uuid in &bind.uuid_list {
jsb.start_object()?;
let ifstr = Uuid::from_slice(uuid.uuid.as_slice());
let ifstr = ifstr.map(|uuid| uuid.to_hyphenated().to_string()).unwrap();
jsb.set_string("uuid", &ifstr)?;
let vstr = format!("{}.{}", uuid.version, uuid.versionminor);
jsb.set_string("version", &vstr)?;
jsb.set_uint("ack_result", uuid.result as u64)?;
jsb.close()?;
}
DCERPC_TYPE_BIND => if let Some(bind) = &state.bind {
jsb.open_array("interfaces")?;
for uuid in &bind.uuid_list {
jsb.start_object()?;
let ifstr = Uuid::from_slice(uuid.uuid.as_slice());
let ifstr = ifstr.map(|uuid| uuid.to_hyphenated().to_string()).unwrap();
jsb.set_string("uuid", &ifstr)?;
let vstr = format!("{}.{}", uuid.version, uuid.versionminor);
jsb.set_string("version", &vstr)?;
jsb.set_uint("ack_result", uuid.result as u64)?;
jsb.close()?;
}
None => {}
jsb.close()?;
},
_ => {}
}

Loading…
Cancel
Save