Skip to content

Commit 77d0d15

Browse files
Made formatting consistent with surrounding code
1 parent 748b0c3 commit 77d0d15

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

library/core/src/str/mod.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -381,15 +381,12 @@ pub fn from_utf8_mut(v: &mut [u8]) -> Result<&mut str, Utf8Error> {
381381
Ok(unsafe { from_utf8_unchecked_mut(v) })
382382
}
383383

384-
385384
#[repr(C)]
386385
union StrOrSlice<'a> {
387386
str: &'a str,
388387
slice: &'a [u8],
389388
}
390389

391-
392-
393390
/// Converts a slice of bytes to a string slice without checking
394391
/// that the string contains valid UTF-8.
395392
///
@@ -429,10 +426,9 @@ union StrOrSlice<'a> {
429426
pub const unsafe fn from_utf8_unchecked(v: &[u8]) -> &str {
430427
// SAFETY: the caller must guarantee that the bytes `v` are valid UTF-8.
431428
// Also relies on `&str` and `&[u8]` having the same layout.
432-
unsafe{ StrOrSlice{ slice: v }.str }
429+
unsafe { StrOrSlice { slice: v }.str }
433430
}
434431

435-
436432
/// Converts a slice of bytes to a string slice without checking
437433
/// that the string contains valid UTF-8; mutable version.
438434
///

0 commit comments

Comments
 (0)