File tree 1 file changed +5
-5
lines changed
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>(
157
157
input : & ' a str ,
158
158
first_uppercase : usize ,
159
159
) -> & ' a str {
160
- unsafe {
160
+
161
161
// This cast doesn't change the pointer's validity
162
162
// 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 > ] ) } ;
164
164
165
165
buffer. copy_from_slice ( & * input_bytes) ;
166
166
167
167
// 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 ] ) } ;
169
169
170
170
buffer[ first_uppercase..] . make_ascii_lowercase ( ) ;
171
171
// `buffer` was initialized to a copy of `input`
172
172
// (which is `&str` so well-formed UTF-8)
173
173
// 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
+
176
176
}
177
177
178
178
Some (
You can’t perform that action at this time.
0 commit comments