diff --git a/rust/src/dcerpc/dcerpc.rs b/rust/src/dcerpc/dcerpc.rs index 5299c0e133..2d5bca3715 100644 --- a/rust/src/dcerpc/dcerpc.rs +++ b/rust/src/dcerpc/dcerpc.rs @@ -696,7 +696,7 @@ impl DCERPCState { if retval == -1 { return -1; } - idx = retval + idx; + idx += retval; } let call_id = self.get_hdr_call_id().unwrap_or(0); let mut tx = self.create_tx(call_id); @@ -941,7 +941,7 @@ impl DCERPCState { if consumed < 2 { consumed = 0; } else { - consumed = consumed - 1; + consumed -= 1; } SCLogDebug!("DCERPC record NOT found"); return AppLayerResult::incomplete(consumed as u32, 2); diff --git a/rust/src/dcerpc/detect.rs b/rust/src/dcerpc/detect.rs index 662e2c20fd..5d616a6642 100644 --- a/rust/src/dcerpc/detect.rs +++ b/rust/src/dcerpc/detect.rs @@ -79,7 +79,7 @@ fn match_backuuid( } } let ctxid = tx.get_req_ctxid(); - ret = ret & ((uuidentry.ctxid == ctxid) as u8); + ret &= (uuidentry.ctxid == ctxid) as u8; if ret == 0 { SCLogDebug!("CTX IDs/UUIDs do not match"); continue; diff --git a/rust/src/http2/detect.rs b/rust/src/http2/detect.rs index 910756d5f0..7a1e689806 100644 --- a/rust/src/http2/detect.rs +++ b/rust/src/http2/detect.rs @@ -135,7 +135,7 @@ fn http2_tx_get_next_priority( if pos == nb { return prio.weight as i32; } else { - pos = pos + 1; + pos += 1; } } HTTP2FrameTypeData::HEADERS(hd) => { @@ -143,7 +143,7 @@ fn http2_tx_get_next_priority( if pos == nb { return prio.weight as i32; } else { - pos = pos + 1; + pos += 1; } } } @@ -157,7 +157,7 @@ fn http2_tx_get_next_priority( if pos == nb { return prio.weight as i32; } else { - pos = pos + 1; + pos += 1; } } HTTP2FrameTypeData::HEADERS(hd) => { @@ -165,7 +165,7 @@ fn http2_tx_get_next_priority( if pos == nb { return prio.weight as i32; } else { - pos = pos + 1; + pos += 1; } } } @@ -195,7 +195,7 @@ fn http2_tx_get_next_window( if pos == nb { return wu.sizeinc as i32; } else { - pos = pos + 1; + pos += 1; } } _ => {} @@ -208,7 +208,7 @@ fn http2_tx_get_next_window( if pos == nb { return wu.sizeinc as i32; } else { - pos = pos + 1; + pos += 1; } } _ => {} @@ -382,7 +382,7 @@ pub unsafe extern "C" fn rs_http2_tx_get_header_name( *buffer_len = value.len() as u32; return 1; } else { - pos = pos + blocks.len() as u32; + pos += blocks.len() as u32; } } } @@ -396,7 +396,7 @@ pub unsafe extern "C" fn rs_http2_tx_get_header_name( *buffer_len = value.len() as u32; return 1; } else { - pos = pos + blocks.len() as u32; + pos += blocks.len() as u32; } } } @@ -830,7 +830,7 @@ pub unsafe extern "C" fn rs_http2_tx_get_header( *buffer_len = value.len() as u32; return 1; } else { - pos = pos + blocks.len() as u32; + pos += blocks.len() as u32; } } } @@ -847,7 +847,7 @@ pub unsafe extern "C" fn rs_http2_tx_get_header( *buffer_len = value.len() as u32; return 1; } else { - pos = pos + blocks.len() as u32; + pos += blocks.len() as u32; } } } diff --git a/rust/src/mqtt/mqtt.rs b/rust/src/mqtt/mqtt.rs index 04691218d5..94b7956f7f 100644 --- a/rust/src/mqtt/mqtt.rs +++ b/rust/src/mqtt/mqtt.rs @@ -185,7 +185,7 @@ impl MQTTState { if self.transactions.len() > unsafe { MQTT_MAX_TX } { let mut index = self.tx_index_completed; for tx_old in &mut self.transactions.range_mut(self.tx_index_completed..) { - index = index + 1; + index += 1; if !tx_old.complete { tx_old.complete = true; MQTTState::set_event(tx_old, MQTTEvent::TooManyTransactions); diff --git a/rust/src/mqtt/parser.rs b/rust/src/mqtt/parser.rs index f73c3b1127..fb938fb9d5 100644 --- a/rust/src/mqtt/parser.rs +++ b/rust/src/mqtt/parser.rs @@ -51,10 +51,10 @@ fn convert_varint(continued: Vec, last: u8) -> u32 { let mut multiplier = 1u32; let mut value = 0u32; for val in &continued { - value = value + ((val & 127) as u32 * multiplier); - multiplier = multiplier * 128u32; + value += (val & 127) as u32 * multiplier; + multiplier *= 128u32; } - value = value + ((last & 127) as u32 * multiplier); + value += (last & 127) as u32 * multiplier; return value; } diff --git a/rust/src/pgsql/parser.rs b/rust/src/pgsql/parser.rs index ab0b00d875..70c091270c 100644 --- a/rust/src/pgsql/parser.rs +++ b/rust/src/pgsql/parser.rs @@ -903,7 +903,7 @@ fn add_up_data_size(columns: Vec) -> u64 { for field in columns { // -1 value means data value is NULL, let's not add that up if field.value_length > 0 { - data_size = data_size + field.value_length as u64; + data_size += field.value_length as u64; } } data_size diff --git a/rust/src/pgsql/pgsql.rs b/rust/src/pgsql/pgsql.rs index 9a19b01637..8fe69e6add 100644 --- a/rust/src/pgsql/pgsql.rs +++ b/rust/src/pgsql/pgsql.rs @@ -76,7 +76,7 @@ impl PgsqlTransaction { } pub fn incr_row_cnt(&mut self) { - self.data_row_cnt = self.data_row_cnt + 1; + self.data_row_cnt += 1; } pub fn get_row_cnt(&self) -> u16 { @@ -84,7 +84,7 @@ impl PgsqlTransaction { } pub fn sum_data_size(&mut self, row_size: u64) { - self.data_size = self.data_size + row_size; + self.data_size += row_size; } } @@ -194,7 +194,7 @@ impl PgsqlState { // to avoid quadratic complexity let mut index = self.tx_index_completed; for tx_old in &mut self.transactions.range_mut(self.tx_index_completed..) { - index = index + 1; + index += 1; if tx_old.tx_state < PgsqlTransactionState::ResponseDone { tx_old.tx_state = PgsqlTransactionState::FlushedOut; //TODO set event diff --git a/rust/src/quic/frames.rs b/rust/src/quic/frames.rs index c713dea42a..b587d0411f 100644 --- a/rust/src/quic/frames.rs +++ b/rust/src/quic/frames.rs @@ -167,7 +167,7 @@ fn parse_padding_frame(input: &[u8]) -> IResult<&[u8], Frame, QuicError> { if input[offset] != 0 { break; } - offset = offset + 1; + offset += 1; } return Ok((&input[offset..], Frame::Padding)); } diff --git a/rust/src/smb/dcerpc.rs b/rust/src/smb/dcerpc.rs index 33774f3e1d..b21c016a1a 100644 --- a/rust/src/smb/dcerpc.rs +++ b/rust/src/smb/dcerpc.rs @@ -356,7 +356,7 @@ fn smb_dcerpc_response_bindack( } ifaces[i].ack_result = r.ack_result; ifaces[i].acked = true; - i = i + 1; + i += 1; } }, _ => {}, diff --git a/rust/src/smb/smb.rs b/rust/src/smb/smb.rs index 9ff56979dd..35fb59bec2 100644 --- a/rust/src/smb/smb.rs +++ b/rust/src/smb/smb.rs @@ -1386,7 +1386,7 @@ impl SMBState { if consumed < 4 { consumed = 0; } else { - consumed = consumed - 3; + consumed -= 3; } SCLogDebug!("smb record NOT found"); return AppLayerResult::incomplete(consumed as u32, 8); @@ -1718,7 +1718,7 @@ impl SMBState { if consumed < 4 { consumed = 0; } else { - consumed = consumed - 3; + consumed -= 3; } SCLogDebug!("smb record NOT found"); return AppLayerResult::incomplete(consumed as u32, 8); diff --git a/rust/src/smb/smb2.rs b/rust/src/smb/smb2.rs index 17389799e6..28ff70a066 100644 --- a/rust/src/smb/smb2.rs +++ b/rust/src/smb/smb2.rs @@ -439,7 +439,7 @@ pub fn smb2_request_record<'b>(state: &mut SMBState, r: &Smb2Record<'b>) if guid_key.msg_id == 0 { b"".to_vec() } else { - guid_key.msg_id = guid_key.msg_id - 1; + guid_key.msg_id -= 1; match state.ssn2vec_map.get(&guid_key) { Some(n) => { n.to_vec() }, None => { b"".to_vec()}, diff --git a/rust/src/smb/smb2_records.rs b/rust/src/smb/smb2_records.rs index 63d0f07884..4baa61e335 100644 --- a/rust/src/smb/smb2_records.rs +++ b/rust/src/smb/smb2_records.rs @@ -606,7 +606,7 @@ fn smb_basic_search(d: &[u8]) -> usize { if window == needle { return r; } - r = r + 1; + r += 1; } return 0; }