We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 4920721 commit 93e6c26Copy full SHA for 93e6c26
src/librustc_data_structures/array_vec.rs
@@ -119,8 +119,16 @@ impl<A: Array> ArrayVec<A> {
119
// the hole, and the vector length is restored to the new length.
120
//
121
let len = self.len();
122
- let start = *range.start().unwrap_or(&0);
123
- let end = *range.end().unwrap_or(&len);
+ let start = match range.start() {
+ 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
132
assert!(start <= end);
133
assert!(end <= len);
134
0 commit comments