Fix 'range patterns are deprecated' warning

This commit can be replicated with `cargo fix`.
This commit is contained in:
Joshua Nelson
2020-10-16 10:13:30 -04:00
committed by Henri Sivonen
parent 44e3381b80
commit 79347dc0ee
2 changed files with 19 additions and 19 deletions
+4 -4
View File
@@ -2685,12 +2685,12 @@ impl Encoding {
0x09u8 | 0x0Au8 | 0x0Cu8 | 0x0Du8 | 0x20u8 => {
continue;
}
b'A'...b'Z' => {
b'A'..=b'Z' => {
trimmed[trimmed_pos] = *byte + 0x20u8;
trimmed_pos = 1usize;
break;
}
b'a'...b'z' | b'0'...b'9' | b'-' | b'_' | b':' | b'.' => {
b'a'..=b'z' | b'0'..=b'9' | b'-' | b'_' | b':' | b'.' => {
trimmed[trimmed_pos] = *byte;
trimmed_pos = 1usize;
break;
@@ -2713,7 +2713,7 @@ impl Encoding {
0x09u8 | 0x0Au8 | 0x0Cu8 | 0x0Du8 | 0x20u8 => {
break;
}
b'A'...b'Z' => {
b'A'..=b'Z' => {
if trimmed_pos == LONGEST_LABEL_LENGTH {
// There's no encoding with a label this long
return None;
@@ -2722,7 +2722,7 @@ impl Encoding {
trimmed_pos += 1usize;
continue;
}
b'a'...b'z' | b'0'...b'9' | b'-' | b'_' | b':' | b'.' => {
b'a'..=b'z' | b'0'..=b'9' | b'-' | b'_' | b':' | b'.' => {
if trimmed_pos == LONGEST_LABEL_LENGTH {
// There's no encoding with a label this long
return None;
+15 -15
View File
@@ -740,13 +740,13 @@ pub fn is_utf8_bidi(buffer: &[u8]) -> bool {
'inner: loop {
// At this point, `byte` is not included in `read`.
match byte {
0...0x7F => {
0..=0x7F => {
// ASCII: go back to SIMD.
read += 1;
src = &src[read..];
continue 'outer;
}
0xC2...0xD5 => {
0xC2..=0xD5 => {
// Two-byte
let second = unsafe { *(src.get_unchecked(read + 1)) };
if !in_inclusive_range8(second, 0x80, 0xBF) {
@@ -767,7 +767,7 @@ pub fn is_utf8_bidi(buffer: &[u8]) -> bool {
read += 2;
}
// two-byte starting with 0xD7 and above is bidi
0xE1 | 0xE3...0xEC | 0xEE => {
0xE1 | 0xE3..=0xEC | 0xEE => {
// Three-byte normal
let second = unsafe { *(src.get_unchecked(read + 1)) };
let third = unsafe { *(src.get_unchecked(read + 2)) };
@@ -876,7 +876,7 @@ pub fn is_utf8_bidi(buffer: &[u8]) -> bool {
}
read += 3;
}
0xF1...0xF4 => {
0xF1..=0xF4 => {
// Four-byte normal
let second = unsafe { *(src.get_unchecked(read + 1)) };
let third = unsafe { *(src.get_unchecked(read + 2)) };
@@ -939,13 +939,13 @@ pub fn is_utf8_bidi(buffer: &[u8]) -> bool {
// At this point, `byte` is not included in `read`.
match byte {
0...0x7F => {
0..=0x7F => {
// ASCII: go back to SIMD.
read += 1;
src = &src[read..];
continue 'outer;
}
0xC2...0xD5 => {
0xC2..=0xD5 => {
// Two-byte
let new_read = read + 2;
if new_read > src.len() {
@@ -982,7 +982,7 @@ pub fn is_utf8_bidi(buffer: &[u8]) -> bool {
continue 'outer;
}
// two-byte starting with 0xD7 and above is bidi
0xE1 | 0xE3...0xEC | 0xEE => {
0xE1 | 0xE3..=0xEC | 0xEE => {
// Three-byte normal
let new_read = read + 3;
if new_read > src.len() {
@@ -3117,11 +3117,11 @@ mod tests {
#[inline(always)]
pub fn reference_is_char_bidi(c: char) -> bool {
match c {
'\u{0590}'...'\u{08FF}'
| '\u{FB1D}'...'\u{FDFF}'
| '\u{FE70}'...'\u{FEFE}'
| '\u{10800}'...'\u{10FFF}'
| '\u{1E800}'...'\u{1EFFF}'
'\u{0590}'..='\u{08FF}'
| '\u{FB1D}'..='\u{FDFF}'
| '\u{FE70}'..='\u{FEFE}'
| '\u{10800}'..='\u{10FFF}'
| '\u{1E800}'..='\u{1EFFF}'
| '\u{200F}'
| '\u{202B}'
| '\u{202E}'
@@ -3133,9 +3133,9 @@ mod tests {
#[inline(always)]
pub fn reference_is_utf16_code_unit_bidi(u: u16) -> bool {
match u {
0x0590...0x08FF
| 0xFB1D...0xFDFF
| 0xFE70...0xFEFE
0x0590..=0x08FF
| 0xFB1D..=0xFDFF
| 0xFE70..=0xFEFE
| 0xD802
| 0xD803
| 0xD83A