File tree Expand file tree Collapse file tree 1 file changed +5
-7
lines changed Expand file tree Collapse file tree 1 file changed +5
-7
lines changed Original file line number Diff line number Diff line change @@ -64,7 +64,7 @@ pub fn parse_with_encoding<'a>(input: &'a [u8],
6464 for sequence in input. split ( |& b| b == b'&' ) {
6565 // No '+' in "_charset_" to replace with ' '.
6666 if sequence. starts_with ( b"_charset_=" ) {
67- let value = unsafe { & sequence. get_unchecked ( b"_charset_=" . len ( ) ..) } ;
67+ let value = & sequence[ b"_charset_=" . len ( ) ..] ;
6868 // Skip replacing '+' with ' ' in value since no encoding label contains either:
6969 // https://encoding.spec.whatwg.org/#names-and-labels
7070 if let Some ( e) = EncodingOverride :: lookup ( value) {
@@ -126,12 +126,10 @@ fn replace_plus(input: &[u8]) -> Cow<[u8]> {
126126 None => Cow :: Borrowed ( input) ,
127127 Some ( first_position) => {
128128 let mut replaced = input. to_owned ( ) ;
129- unsafe {
130- * replaced. get_unchecked_mut ( first_position) = b' ' ;
131- for byte in replaced. get_unchecked_mut ( first_position + 1 ..) {
132- if * byte == b'+' {
133- * byte = b' ' ;
134- }
129+ replaced[ first_position] = b' ' ;
130+ for byte in & mut replaced[ first_position + 1 ..] {
131+ if * byte == b'+' {
132+ * byte = b' ' ;
135133 }
136134 }
137135 Cow :: Owned ( replaced)
You can’t perform that action at this time.
0 commit comments