]> git.lizzy.rs Git - rust.git/commitdiff
Reborrow mut slice instead of converting it with `as_ref`
authorLinda_pp <rhysd@users.noreply.github.com>
Sun, 21 Nov 2021 02:01:31 +0000 (11:01 +0900)
committerGitHub <noreply@github.com>
Sun, 21 Nov 2021 02:01:31 +0000 (11:01 +0900)
Co-authored-by: Noah Lev <camelidcamel@gmail.com>
library/core/src/array/mod.rs

index 700fa7f4e2d2814c1c0803104d384ca7f1028306..181f8b408e61baad61a65eb3a5753efdd11d3d01 100644 (file)
@@ -184,7 +184,7 @@ fn borrow_mut(&mut self) -> &mut [T] {
     type Error = TryFromSliceError;
 
     fn try_from(slice: &mut [T]) -> Result<[T; N], TryFromSliceError> {
-        <Self>::try_from(slice.as_ref())
+        <Self>::try_from(&*slice)
     }
 }