@@ -130,7 +130,7 @@ impl<K, V> Slice<K, V> {
130
130
/// Returns the first key-value pair and the rest of the slice,
131
131
/// or `None` if it is empty.
132
132
pub fn split_first ( & self ) -> Option < ( ( & K , & V ) , & Self ) > {
133
- if let Some ( ( first, rest) ) = self . entries . split_first ( ) {
133
+ if let [ first, rest @ .. ] = & self . entries {
134
134
Some ( ( first. refs ( ) , Self :: from_slice ( rest) ) )
135
135
} else {
136
136
None
@@ -140,7 +140,7 @@ impl<K, V> Slice<K, V> {
140
140
/// Returns the first key-value pair and the rest of the slice,
141
141
/// with mutable access to the value, or `None` if it is empty.
142
142
pub fn split_first_mut ( & mut self ) -> Option < ( ( & K , & mut V ) , & mut Self ) > {
143
- if let Some ( ( first, rest) ) = self . entries . split_first_mut ( ) {
143
+ if let [ first, rest @ .. ] = & mut self . entries {
144
144
Some ( ( first. ref_mut ( ) , Self :: from_mut_slice ( rest) ) )
145
145
} else {
146
146
None
@@ -150,7 +150,7 @@ impl<K, V> Slice<K, V> {
150
150
/// Returns the last key-value pair and the rest of the slice,
151
151
/// or `None` if it is empty.
152
152
pub fn split_last ( & self ) -> Option < ( ( & K , & V ) , & Self ) > {
153
- if let Some ( ( last , rest ) ) = self . entries . split_last ( ) {
153
+ if let [ rest @ .. , last ] = & self . entries {
154
154
Some ( ( last. refs ( ) , Self :: from_slice ( rest) ) )
155
155
} else {
156
156
None
@@ -160,7 +160,7 @@ impl<K, V> Slice<K, V> {
160
160
/// Returns the last key-value pair and the rest of the slice,
161
161
/// with mutable access to the value, or `None` if it is empty.
162
162
pub fn split_last_mut ( & mut self ) -> Option < ( ( & K , & mut V ) , & mut Self ) > {
163
- if let Some ( ( last , rest ) ) = self . entries . split_last_mut ( ) {
163
+ if let [ rest @ .. , last ] = & mut self . entries {
164
164
Some ( ( last. ref_mut ( ) , Self :: from_mut_slice ( rest) ) )
165
165
} else {
166
166
None
0 commit comments