diff options
| author | djzin <noreply@github.com> | 2017-01-14 17:06:00 +0000 |
|---|---|---|
| committer | djzin <noreply@github.com> | 2017-01-14 17:06:00 +0000 |
| commit | 93e6c26dcf557e4411eb033f0dd8f96401c879c6 (patch) | |
| tree | 06b6f248be56a841e9ec9ba0614e1c51501dd139 /src/librustc_data_structures | |
| parent | 4920721f6c25e5e5e5330617e75be4be046e144b (diff) | |
| download | rust-93e6c26dcf557e4411eb033f0dd8f96401c879c6.tar.gz rust-93e6c26dcf557e4411eb033f0dd8f96401c879c6.zip | |
update array_vec to use new rangeargument
Diffstat (limited to 'src/librustc_data_structures')
| -rw-r--r-- | src/librustc_data_structures/array_vec.rs | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/librustc_data_structures/array_vec.rs b/src/librustc_data_structures/array_vec.rs index 844e9041d20..9baaa44a370 100644 --- a/src/librustc_data_structures/array_vec.rs +++ b/src/librustc_data_structures/array_vec.rs @@ -119,8 +119,16 @@ impl<A: Array> ArrayVec<A> { // the hole, and the vector length is restored to the new length. // let len = self.len(); - let start = *range.start().unwrap_or(&0); - let end = *range.end().unwrap_or(&len); + let start = match range.start() { + Included(&n) => n, + Excluded(&n) => n + 1, + Unbounded => 0, + }; + let end = match range.end() { + Included(&n) => n + 1, + Excluded(&n) => n, + Unbounded => len, + }; assert!(start <= end); assert!(end <= len); |
