Fixed transmute argument

This commit is contained in:
rodrimati1992 2020-08-13 16:08:22 -03:00 committed by GitHub
parent 1767c8bdf0
commit 18377082f1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -420,7 +420,7 @@ pub fn from_utf8_mut(v: &mut [u8]) -> Result<&mut str, Utf8Error> {
pub const unsafe fn from_utf8_unchecked(v: &[u8]) -> &str {
// SAFETY: the caller must guarantee that the bytes `v` are valid UTF-8.
// Also relies on `&str` and `&[u8]` having the same layout.
unsafe { mem::transmute(self) }
unsafe { mem::transmute(v) }
}
/// Converts a slice of bytes to a string slice without checking