File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -281,16 +281,16 @@ unsafe impl SliceIndex<str> for (ops::Bound<usize>, ops::Bound<usize>) {
281281
282282 #[ inline]
283283 unsafe fn get_unchecked ( self , slice : * const str ) -> * const str {
284+ let len = ( slice as * const [ u8 ] ) . len ( ) ;
284285 // SAFETY: the caller has to uphold the safety contract for `get_unchecked`.
285- unsafe { crate :: slice:: index:: into_range_unchecked ( slice . len ( ) , self ) . get_unchecked ( slice) }
286+ unsafe { crate :: slice:: index:: into_range_unchecked ( len, self ) . get_unchecked ( slice) }
286287 }
287288
288289 #[ inline]
289290 unsafe fn get_unchecked_mut ( self , slice : * mut str ) -> * mut str {
291+ let len = ( slice as * mut [ u8 ] ) . len ( ) ;
290292 // SAFETY: the caller has to uphold the safety contract for `get_unchecked_mut`.
291- unsafe {
292- crate :: slice:: index:: into_range_unchecked ( slice. len ( ) , self ) . get_unchecked_mut ( slice)
293- }
293+ unsafe { crate :: slice:: index:: into_range_unchecked ( len, self ) . get_unchecked_mut ( slice) }
294294 }
295295
296296 #[ inline]
You can’t perform that action at this time.
0 commit comments