We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent c3733a7 commit 1977c62Copy full SHA for 1977c62
src/libcore/str/mod.rs
@@ -2246,13 +2246,11 @@ impl str {
2246
#[inline(always)]
2247
#[rustc_const_unstable(feature="const_str_as_bytes")]
2248
pub const fn as_bytes(&self) -> &[u8] {
2249
- unsafe {
2250
- union Slices<'a> {
2251
- str: &'a str,
2252
- slice: &'a [u8],
2253
- }
2254
- Slices { str: self }.slice
+ union Slices<'a> {
+ str: &'a str,
+ slice: &'a [u8],
2255
}
+ unsafe { Slices { str: self }.slice }
2256
2257
2258
/// Converts a mutable string slice to a mutable byte slice. To convert the
0 commit comments