Skip to content

Commit 93e6c26

Browse files
committed
update array_vec to use new rangeargument
1 parent 4920721 commit 93e6c26

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/librustc_data_structures/array_vec.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,16 @@ impl<A: Array> ArrayVec<A> {
119119
// the hole, and the vector length is restored to the new length.
120120
//
121121
let len = self.len();
122-
let start = *range.start().unwrap_or(&0);
123-
let end = *range.end().unwrap_or(&len);
122+
let start = match range.start() {
123+
Included(&n) => n,
124+
Excluded(&n) => n + 1,
125+
Unbounded => 0,
126+
};
127+
let end = match range.end() {
128+
Included(&n) => n + 1,
129+
Excluded(&n) => n,
130+
Unbounded => len,
131+
};
124132
assert!(start <= end);
125133
assert!(end <= len);
126134

0 commit comments

Comments
 (0)