use cargo fix to automatically fix range pattern
diff --git a/src/legacy.rs b/src/legacy.rs index 96ab482..33803cd 100644 --- a/src/legacy.rs +++ b/src/legacy.rs
@@ -162,7 +162,7 @@ if escape.starts_with('u') { let digits = &escape[1..]; let all_lower_hex = digits.chars().all(|c| match c { - '0'...'9' | 'a'...'f' => true, + '0'..='9' | 'a'..='f' => true, _ => false, }); let c = u32::from_str_radix(digits, 16)
diff --git a/src/lib.rs b/src/lib.rs index 1473c9b..176cb71 100644 --- a/src/lib.rs +++ b/src/lib.rs
@@ -70,7 +70,7 @@ if let Some(i) = s.find(llvm) { 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, }); @@ -160,7 +160,7 @@ // Copied from the documentation of `char::is_ascii_alphanumeric` fn is_ascii_alphanumeric(c: char) -> bool { match c { - '\u{0041}'...'\u{005A}' | '\u{0061}'...'\u{007A}' | '\u{0030}'...'\u{0039}' => true, + '\u{0041}'..='\u{005A}' | '\u{0061}'..='\u{007A}' | '\u{0030}'..='\u{0039}' => true, _ => false, } } @@ -168,10 +168,10 @@ // Copied from the documentation of `char::is_ascii_punctuation` fn is_ascii_punctuation(c: char) -> bool { match c { - '\u{0021}'...'\u{002F}' - | '\u{003A}'...'\u{0040}' - | '\u{005B}'...'\u{0060}' - | '\u{007B}'...'\u{007E}' => true, + '\u{0021}'..='\u{002F}' + | '\u{003A}'..='\u{0040}' + | '\u{005B}'..='\u{0060}' + | '\u{007B}'..='\u{007E}' => true, _ => false, } }
diff --git a/src/v0.rs b/src/v0.rs index 8afaca1..96ed69d 100644 --- a/src/v0.rs +++ b/src/v0.rs
@@ -32,7 +32,7 @@ // Paths always start with uppercase characters. match inner.as_bytes()[0] { - b'A'...b'Z' => {} + b'A'..=b'Z' => {} _ => return Err(Invalid), } @@ -50,7 +50,7 @@ // Instantiating crate (paths always start with uppercase characters). match parser.sym.as_bytes().get(parser.next) { - Some(&b'A'...b'Z') => { + Some(&(b'A'..=b'Z')) => { try!(parser.skip_path()); } _ => {} @@ -159,8 +159,8 @@ let t = min(max(k.saturating_sub(bias), t_min), t_max); let d = match punycode_bytes.next() { - Some(d @ b'a'...b'z') => d - b'a', - Some(d @ b'0'...b'9') => 26 + (d - b'0'), + Some(d @ b'a'..=b'z') => d - b'a', + Some(d @ b'0'..=b'9') => 26 + (d - b'0'), _ => return Err(()), }; let d = d as usize; @@ -295,7 +295,7 @@ let start = self.next; loop { match try!(self.next()) { - b'0'...b'9' | b'a'...b'f' => {} + b'0'..=b'9' | b'a'..=b'f' => {} b'_' => break, _ => return Err(Invalid), } @@ -305,7 +305,7 @@ fn digit_10(&mut self) -> Result<u8, Invalid> { let d = match self.peek() { - Some(d @ b'0'...b'9') => d - b'0', + Some(d @ b'0'..=b'9') => d - b'0', _ => return Err(Invalid), }; self.next += 1; @@ -314,9 +314,9 @@ fn digit_62(&mut self) -> Result<u8, Invalid> { let d = match self.peek() { - Some(d @ b'0'...b'9') => d - b'0', - Some(d @ b'a'...b'z') => 10 + (d - b'a'), - Some(d @ b'A'...b'Z') => 10 + 26 + (d - b'A'), + Some(d @ b'0'..=b'9') => d - b'0', + Some(d @ b'a'..=b'z') => 10 + (d - b'a'), + Some(d @ b'A'..=b'Z') => 10 + 26 + (d - b'A'), _ => return Err(Invalid), }; self.next += 1; @@ -351,10 +351,10 @@ fn namespace(&mut self) -> Result<Option<char>, Invalid> { match try!(self.next()) { // Special namespaces, like closures and shims. - ns @ b'A'...b'Z' => Ok(Some(ns as char)), + ns @ b'A'..=b'Z' => Ok(Some(ns as char)), // Implementation-specific/unspecified namespaces. - b'a'...b'z' => Ok(None), + b'a'..=b'z' => Ok(None), _ => Err(Invalid), }