Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion glib/src/bytes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ impl Bytes {
Bound::Excluded(v) => v.checked_add(1).expect("Invalid start offset"),
Bound::Unbounded => 0,
};
assert!(start_offset < len, "Start offset after valid range");
assert!(start_offset <= len, "Start offset after valid range");

let end_offset = match range.end_bound() {
Bound::Included(v) => v.checked_add(1).expect("Invalid end offset"),
Expand Down Expand Up @@ -338,6 +338,8 @@ mod tests {
assert_eq!(b2, [1u8, 2u8].as_ref());
let b2 = Bytes::from_bytes(&b1, ..);
assert_eq!(b2, [1u8, 2u8, 3u8].as_ref());
let b2 = Bytes::from_bytes(&b1, 3..);
assert_eq!(b2, [].as_ref());
}

#[test]
Expand Down
Loading