File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed
Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -157,22 +157,22 @@ pub fn _cssparser_internal_to_lowercase<'a>(
157157 input : & ' a str ,
158158 first_uppercase : usize ,
159159 ) -> & ' a str {
160- unsafe {
160+
161161 // This cast doesn't change the pointer's validity
162162 // since `u8` has the same layout as `MaybeUninit<u8>`:
163- let input_bytes = & * ( input. as_bytes ( ) as * const [ u8 ] as * const [ MaybeUninit < u8 > ] ) ;
163+ let input_bytes = unsafe { & * ( input. as_bytes ( ) as * const [ u8 ] as * const [ MaybeUninit < u8 > ] ) } ;
164164
165165 buffer. copy_from_slice ( & * input_bytes) ;
166166
167167 // Same as above re layout, plus these bytes have been initialized:
168- let buffer = & mut * ( buffer as * mut [ MaybeUninit < u8 > ] as * mut [ u8 ] ) ;
168+ let buffer = unsafe { & mut * ( buffer as * mut [ MaybeUninit < u8 > ] as * mut [ u8 ] ) } ;
169169
170170 buffer[ first_uppercase..] . make_ascii_lowercase ( ) ;
171171 // `buffer` was initialized to a copy of `input`
172172 // (which is `&str` so well-formed UTF-8)
173173 // then ASCII-lowercased (which preserves UTF-8 well-formedness):
174- :: std:: str:: from_utf8_unchecked ( buffer)
175- }
174+ unsafe { :: std:: str:: from_utf8_unchecked ( buffer) }
175+
176176 }
177177
178178 Some (
You can’t perform that action at this time.
0 commit comments