migrate codebase to ..= inclusive range patterns
These were stabilized in March 2018's #47813, and are the Preferred Way to Do It going forward (q.v. #51043).
This commit is contained in:
@@ -263,7 +263,7 @@ pub fn demangle(writer: &mut Write, mut s: &str, format: PrintFormat) -> io::Res
|
||||
let candidate = &s[i + llvm.len()..];
|
||||
let all_hex = candidate.chars().all(|c| {
|
||||
match c {
|
||||
'A' ... 'F' | '0' ... '9' => true,
|
||||
'A' ..= 'F' | '0' ..= '9' => true,
|
||||
_ => false,
|
||||
}
|
||||
});
|
||||
|
||||
@@ -76,7 +76,7 @@ impl CodePoint {
|
||||
#[inline]
|
||||
pub fn from_u32(value: u32) -> Option<CodePoint> {
|
||||
match value {
|
||||
0 ... 0x10FFFF => Some(CodePoint { value: value }),
|
||||
0 ..= 0x10FFFF => Some(CodePoint { value: value }),
|
||||
_ => None
|
||||
}
|
||||
}
|
||||
@@ -101,7 +101,7 @@ impl CodePoint {
|
||||
#[inline]
|
||||
pub fn to_char(&self) -> Option<char> {
|
||||
match self.value {
|
||||
0xD800 ... 0xDFFF => None,
|
||||
0xD800 ..= 0xDFFF => None,
|
||||
_ => Some(unsafe { char::from_u32_unchecked(self.value) })
|
||||
}
|
||||
}
|
||||
@@ -305,7 +305,7 @@ impl Wtf8Buf {
|
||||
/// like concatenating ill-formed UTF-16 strings effectively would.
|
||||
#[inline]
|
||||
pub fn push(&mut self, code_point: CodePoint) {
|
||||
if let trail @ 0xDC00...0xDFFF = code_point.to_u32() {
|
||||
if let trail @ 0xDC00..=0xDFFF = code_point.to_u32() {
|
||||
if let Some(lead) = (&*self).final_lead_surrogate() {
|
||||
let len_without_lead_surrogate = self.len() - 3;
|
||||
self.bytes.truncate(len_without_lead_surrogate);
|
||||
@@ -525,7 +525,7 @@ impl Wtf8 {
|
||||
#[inline]
|
||||
pub fn ascii_byte_at(&self, position: usize) -> u8 {
|
||||
match self.bytes[position] {
|
||||
ascii_byte @ 0x00 ... 0x7F => ascii_byte,
|
||||
ascii_byte @ 0x00 ..= 0x7F => ascii_byte,
|
||||
_ => 0xFF
|
||||
}
|
||||
}
|
||||
@@ -630,7 +630,7 @@ impl Wtf8 {
|
||||
return None
|
||||
}
|
||||
match &self.bytes[(len - 3)..] {
|
||||
&[0xED, b2 @ 0xA0...0xAF, b3] => Some(decode_surrogate(b2, b3)),
|
||||
&[0xED, b2 @ 0xA0..=0xAF, b3] => Some(decode_surrogate(b2, b3)),
|
||||
_ => None
|
||||
}
|
||||
}
|
||||
@@ -642,7 +642,7 @@ impl Wtf8 {
|
||||
return None
|
||||
}
|
||||
match &self.bytes[..3] {
|
||||
&[0xED, b2 @ 0xB0...0xBF, b3] => Some(decode_surrogate(b2, b3)),
|
||||
&[0xED, b2 @ 0xB0..=0xBF, b3] => Some(decode_surrogate(b2, b3)),
|
||||
_ => None
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user