Skip to content

Commit f24856c

Browse files
committed
remove nesting
1 parent effadc4 commit f24856c

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

src/matchers/archive.rs

+9-8
Original file line numberDiff line numberDiff line change
@@ -218,16 +218,17 @@ pub fn is_zst(buf: &[u8]) -> bool {
218218
}
219219

220220
let magic = u32::from_le_bytes(buf[0..4].try_into().unwrap()) as usize;
221-
if magic & ZSTD_SKIP_MASK == ZSTD_SKIP_START {
222-
let data_len = u32::from_le_bytes(buf[4..8].try_into().unwrap()) as usize;
223-
if buf.len() < 8 + data_len {
224-
return false;
225-
}
226-
let next_frame = &buf[8 + data_len..];
227-
return is_zst(next_frame);
221+
if magic & ZSTD_SKIP_MASK != ZSTD_SKIP_START {
222+
return false;
223+
}
224+
225+
let data_len = u32::from_le_bytes(buf[4..8].try_into().unwrap()) as usize;
226+
if buf.len() < 8 + data_len {
227+
return false;
228228
}
229229

230-
false
230+
let next_frame = &buf[8 + data_len..];
231+
is_zst(next_frame)
231232
}
232233

233234
/// Returns whether a buffer is a MSI Windows Installer archive.

0 commit comments

Comments
 (0)