Skip to content

Commit

Permalink
rust: fix clippy warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
inashivb authored and victorjulien committed Jul 13, 2023
1 parent 0068b81 commit d4e674b
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 11 deletions.
2 changes: 1 addition & 1 deletion rust/src/dcerpc/dcerpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -723,7 +723,7 @@ impl DCERPCState {
Ok((leftover_bytes, mut back)) => {
if let Some(ref mut bind) = self.bind {
for (uuid_internal_id, r) in back.ctxitems.iter().enumerate() {
for mut uuid in bind.uuid_list.iter_mut() {
for uuid in bind.uuid_list.iter_mut() {
if uuid.internal_id == uuid_internal_id as u16 {
uuid.result = r.ack_result;
if uuid.result != 0 {
Expand Down
2 changes: 1 addition & 1 deletion rust/src/http2/http2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -969,7 +969,7 @@ impl HTTP2State {
//borrow checker forbids to reuse directly tx
let index = self.find_tx_index(sid);
if index > 0 {
let mut tx_same = &mut self.transactions[index - 1];
let tx_same = &mut self.transactions[index - 1];
if dir == Direction::ToServer {
tx_same.ft_tc.tx_id = tx_same.tx_id - 1;
} else {
Expand Down
2 changes: 1 addition & 1 deletion rust/src/ike/ikev2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ impl Default for Ikev2Container {
}

pub fn handle_ikev2(
mut state: &mut IKEState, current: &[u8], isakmp_header: IsakmpHeader, direction: Direction,
state: &mut IKEState, current: &[u8], isakmp_header: IsakmpHeader, direction: Direction,
) -> AppLayerResult {
let hdr = IkeV2Header {
init_spi: isakmp_header.init_spi,
Expand Down
5 changes: 1 addition & 4 deletions rust/src/krb/detect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,7 @@ pub enum DetectKrb5TicketEncryptionData {
pub fn detect_parse_encryption_weak(i: &str) -> IResult<&str, DetectKrb5TicketEncryptionData> {
let (i, neg) = opt(char('!'))(i)?;
let (i, _) = tag("weak")(i)?;
let value = match neg {
Some(_) => false,
_ => true,
};
let value = neg.is_none();
return Ok((i, DetectKrb5TicketEncryptionData::WEAK(value)));
}

Expand Down
4 changes: 2 additions & 2 deletions rust/src/smb/smb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1951,7 +1951,7 @@ pub unsafe extern "C" fn rs_smb_parse_request_tcp(flow: *const Flow,
)
-> AppLayerResult
{
let mut state = cast_pointer!(state, SMBState);
let state = cast_pointer!(state, SMBState);
let flow = cast_pointer!(flow, Flow);

if stream_slice.is_gap() {
Expand Down Expand Up @@ -1988,7 +1988,7 @@ pub unsafe extern "C" fn rs_smb_parse_response_tcp(flow: *const Flow,
)
-> AppLayerResult
{
let mut state = cast_pointer!(state, SMBState);
let state = cast_pointer!(state, SMBState);
let flow = cast_pointer!(flow, Flow);

if stream_slice.is_gap() {
Expand Down
4 changes: 2 additions & 2 deletions rust/src/ssh/ssh.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ impl SSHState {
fn parse_record(
&mut self, mut input: &[u8], resp: bool, pstate: *mut std::os::raw::c_void,
) -> AppLayerResult {
let (mut hdr, ohdr) = if !resp {
let (hdr, ohdr) = if !resp {
(&mut self.transaction.cli_hdr, &self.transaction.srv_hdr)
} else {
(&mut self.transaction.srv_hdr, &self.transaction.cli_hdr)
Expand Down Expand Up @@ -240,7 +240,7 @@ impl SSHState {
fn parse_banner(
&mut self, input: &[u8], resp: bool, pstate: *mut std::os::raw::c_void,
) -> AppLayerResult {
let mut hdr = if !resp {
let hdr = if !resp {
&mut self.transaction.cli_hdr
} else {
&mut self.transaction.srv_hdr
Expand Down

0 comments on commit d4e674b

Please sign in to comment.