Skip to content

Commit 824271f

Browse files
committed
Get rid of duplicate element size check.
1 parent 37ead6e commit 824271f

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

src/lib.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -547,8 +547,6 @@ impl QueueFile {
547547
let elem = elem.as_ref();
548548
let len = elem.len();
549549

550-
ensure!(i32::try_from(len).is_ok(), ElementTooBigSnafu {});
551-
552550
if first_added.is_none() {
553551
first_added = Some(Element::new(pos, len)?);
554552
}
@@ -1194,9 +1192,7 @@ impl Element {
11941192
ensure!(i64::try_from(pos).is_ok(), CorruptedFileSnafu {
11951193
msg: "element position must be less or equal to i64::MAX"
11961194
});
1197-
ensure!(i32::try_from(len).is_ok(), CorruptedFileSnafu {
1198-
msg: "element length must be less or equal to i32::MAX"
1199-
});
1195+
ensure!(i32::try_from(len).is_ok(), ElementTooBigSnafu);
12001196

12011197
Ok(Self { pos, len })
12021198
}

0 commit comments

Comments
 (0)