diff options
| author | Zack M. Davis <code@zackmdavis.net> | 2018-05-28 19:42:11 -0700 |
|---|---|---|
| committer | Zack M. Davis <code@zackmdavis.net> | 2018-06-26 07:53:30 -0700 |
| commit | 057715557b51af125847da6d19b2e016283c5ae7 (patch) | |
| tree | dfe0cc5a807ac7ed47bb77893f1c69198be825f6 /src/libserialize/json.rs | |
| parent | 764232cb2a8407c72b9fea68835e686240e30ef3 (diff) | |
| download | rust-057715557b51af125847da6d19b2e016283c5ae7.tar.gz rust-057715557b51af125847da6d19b2e016283c5ae7.zip | |
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).
Diffstat (limited to 'src/libserialize/json.rs')
| -rw-r--r-- | src/libserialize/json.rs | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/libserialize/json.rs b/src/libserialize/json.rs index efdad7d801a..9959d5ce40d 100644 --- a/src/libserialize/json.rs +++ b/src/libserialize/json.rs @@ -1557,14 +1557,14 @@ impl<T: Iterator<Item=char>> Parser<T> { self.bump(); // A leading '0' must be the only digit before the decimal point. - if let '0' ... '9' = self.ch_or_null() { + if let '0' ..= '9' = self.ch_or_null() { return self.error(InvalidNumber) } }, - '1' ... '9' => { + '1' ..= '9' => { while !self.eof() { match self.ch_or_null() { - c @ '0' ... '9' => { + c @ '0' ..= '9' => { accum = accum.wrapping_mul(10); accum = accum.wrapping_add((c as u64) - ('0' as u64)); @@ -1588,14 +1588,14 @@ impl<T: Iterator<Item=char>> Parser<T> { // Make sure a digit follows the decimal place. match self.ch_or_null() { - '0' ... '9' => (), + '0' ..= '9' => (), _ => return self.error(InvalidNumber) } let mut dec = 1.0; while !self.eof() { match self.ch_or_null() { - c @ '0' ... '9' => { + c @ '0' ..= '9' => { dec /= 10.0; res += (((c as isize) - ('0' as isize)) as f64) * dec; self.bump(); @@ -1622,12 +1622,12 @@ impl<T: Iterator<Item=char>> Parser<T> { // Make sure a digit follows the exponent place. match self.ch_or_null() { - '0' ... '9' => (), + '0' ..= '9' => (), _ => return self.error(InvalidNumber) } while !self.eof() { match self.ch_or_null() { - c @ '0' ... '9' => { + c @ '0' ..= '9' => { exp *= 10; exp += (c as usize) - ('0' as usize); @@ -1653,7 +1653,7 @@ impl<T: Iterator<Item=char>> Parser<T> { while i < 4 && !self.eof() { self.bump(); n = match self.ch_or_null() { - c @ '0' ... '9' => n * 16 + ((c as u16) - ('0' as u16)), + c @ '0' ..= '9' => n * 16 + ((c as u16) - ('0' as u16)), 'a' | 'A' => n * 16 + 10, 'b' | 'B' => n * 16 + 11, 'c' | 'C' => n * 16 + 12, @@ -1695,13 +1695,13 @@ impl<T: Iterator<Item=char>> Parser<T> { 'r' => res.push('\r'), 't' => res.push('\t'), 'u' => match self.decode_hex_escape()? { - 0xDC00 ... 0xDFFF => { + 0xDC00 ..= 0xDFFF => { return self.error(LoneLeadingSurrogateInHexEscape) } // Non-BMP characters are encoded as a sequence of // two hex escapes, representing UTF-16 surrogates. - n1 @ 0xD800 ... 0xDBFF => { + n1 @ 0xD800 ..= 0xDBFF => { match (self.next_char(), self.next_char()) { (Some('\\'), Some('u')) => (), _ => return self.error(UnexpectedEndOfHexEscape), @@ -1928,7 +1928,7 @@ impl<T: Iterator<Item=char>> Parser<T> { 'n' => { self.parse_ident("ull", NullValue) } 't' => { self.parse_ident("rue", BooleanValue(true)) } 'f' => { self.parse_ident("alse", BooleanValue(false)) } - '0' ... '9' | '-' => self.parse_number(), + '0' ..= '9' | '-' => self.parse_number(), '"' => match self.parse_str() { Ok(s) => StringValue(s), Err(e) => Error(e), |
