Skip to content

Commit dd133e1

Browse files
committed
linting fixes
1 parent ea52c82 commit dd133e1

File tree

3 files changed

+12
-9
lines changed

3 files changed

+12
-9
lines changed

src/packer/encryption.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,8 @@ pub fn calculate_entropy(data: &[u8]) -> f64 {
109109
}
110110

111111
let len = data.len() as f64;
112-
frequency.iter()
112+
frequency
113+
.iter()
113114
.filter(|&&count| count > 0)
114115
.map(|&count| {
115116
let probability = count as f64 / len;

src/pe/parser.rs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ impl<'a> PEParser<'a> {
2424
) -> &'b [u8] {
2525
let start = section.pointer_to_raw_data as usize;
2626
let size = section.size_of_raw_data as usize;
27-
if start >= buffer.len() {
27+
if start >= buffer.len() {
2828
return &buffer[0..0];
2929
}
3030
let end = start.saturating_add(size).min(buffer.len());
@@ -49,11 +49,11 @@ impl<'a> PEParser<'a> {
4949

5050
// Helper: raw DOS header bytes (first 64 bytes)
5151
pub fn get_dos_header(&self) -> Option<&[u8]> {
52-
if self.data.len() >= 64 {
53-
Some(&self.data[..64])
54-
} else {
55-
None
56-
}
52+
if self.data.len() >= 64 {
53+
Some(&self.data[..64])
54+
} else {
55+
None
56+
}
5757
}
5858

5959
// Helper: raw COFF header bytes (20 bytes at e_lfanew + 4)
@@ -74,7 +74,9 @@ impl<'a> PEParser<'a> {
7474
let coff_start = pe_off.checked_add(4)?;
7575
let size_opt = if coff_start + 18 <= self.data.len() {
7676
u16::from_le_bytes([self.data[coff_start + 16], self.data[coff_start + 17]]) as usize
77-
} else { return None };
77+
} else {
78+
return None
79+
};
7880
let opt_start = coff_start.checked_add(20)?;
7981
let opt_end = opt_start.checked_add(size_opt)?;
8082
if opt_end <= self.data.len() {

src/python/helpers.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ pub fn is_valid_pe(data: &[u8]) -> bool {
3232
}
3333

3434
// Check PE signature
35-
if data[offset..offset+4] == [0x50, 0x45, 0x00, 0x00] {
35+
if data[offset..offset + 4] == [0x50, 0x45, 0x00, 0x00] {
3636
// PE\0\0
3737
return true;
3838
}

0 commit comments

Comments
 (0)