Skip to content

Commit 77cd361

Browse files
committed
Use efficient vec manipulation.
Signed-off-by: Ana Hobden <operator@hoverbear.org>
1 parent 769101b commit 77cd361

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

src/lib.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -624,16 +624,14 @@ fn range_to_keys(range: (Bound<Key>, Bound<Key>)) -> Result<(Key, Option<Key>)>
624624
let start = match range.0 {
625625
Bound::Included(v) => v,
626626
Bound::Excluded(mut v) => {
627-
let mut buf = b"\0".to_vec();
628-
buf.append(&mut v.0);
629-
Key(buf)
627+
v.0.push(b"\0"[0]);
628+
v
630629
}
631630
Bound::Unbounded => Err(Error::invalid_key_range())?,
632631
};
633632
let end = match range.1 {
634633
Bound::Included(mut v) => {
635-
let mut buf = b"\0".to_vec();
636-
v.0.append(&mut buf);
634+
v.0.push(b"\0"[0]);
637635
Some(v)
638636
}
639637
Bound::Excluded(v) => Some(v),

0 commit comments

Comments
 (0)