Skip to content

Commit 5b4859a

Browse files
authored
Fix rust clippy lints for 1.66 (#158)
* fix clippy lints for 1.66 * cargo fmt fix
1 parent 7716a5c commit 5b4859a

File tree

3 files changed

+7
-9
lines changed

3 files changed

+7
-9
lines changed

src/c_api.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ pub fn c_decrypt_aes_gcm(key: &[u8], iv: &[u8], ciphertext: &[u8]) -> Vec<u8> {
144144
};
145145

146146
unsafe {
147-
pt_out.set_len(pt_len as usize);
147+
pt_out.set_len(pt_len);
148148
}
149149

150150
pt_out

src/elligator.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,9 @@ pub fn extract_payloads(
6666
// of the 92 byte magic number here.
6767
let mut stego_repr_and_fsp: [u8; REPRESENTATIVE_AND_FSP_LEN] =
6868
[0; REPRESENTATIVE_AND_FSP_LEN];
69-
let mut in_offset: usize = tls_payload.len() as usize - 92;
69+
let mut in_offset: usize = tls_payload.len() - 92;
7070
let mut out_offset: usize = 0;
71-
while in_offset < (tls_payload.len() - 3) as usize
72-
&& out_offset < (REPRESENTATIVE_AND_FSP_LEN - 2) as usize
73-
{
71+
while in_offset < (tls_payload.len() - 3) && out_offset < (REPRESENTATIVE_AND_FSP_LEN - 2) {
7472
extract_stego_bytes(
7573
&tls_payload[in_offset..in_offset + 4],
7674
&mut stego_repr_and_fsp[out_offset..out_offset + 3],
@@ -143,9 +141,9 @@ pub fn extract_payloads(
143141
));
144142
return Err(err);
145143
}
146-
in_offset = tls_payload.len() as usize - 92 - vsp_stego_size as usize;
144+
in_offset = tls_payload.len() - 92 - vsp_stego_size as usize;
147145
out_offset = 0;
148-
while in_offset < (tls_payload.len() - 3) as usize && out_offset < (vsp_size - 2) as usize {
146+
while in_offset < (tls_payload.len() - 3) && out_offset < (vsp_size - 2) as usize {
149147
extract_stego_bytes(
150148
&tls_payload[in_offset..in_offset + 4],
151149
&mut encrypted_variable_size_payload[out_offset..out_offset + 3],

src/process_packet.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,8 @@ pub unsafe extern "C" fn rust_process_packet(
7676
#[allow(unused_mut)]
7777
let mut global = &mut *ptr;
7878

79-
let mut rust_view_len = frame_len as usize;
80-
let rust_view = slice::from_raw_parts_mut(raw_ethframe as *mut u8, frame_len as usize);
79+
let mut rust_view_len = frame_len;
80+
let rust_view = slice::from_raw_parts_mut(raw_ethframe as *mut u8, frame_len);
8181

8282
// If this is a GRE, we want to ignore the GRE overhead in our packets
8383
rust_view_len -= global.gre_offset;

0 commit comments

Comments
 (0)