Skip to content

Commit dbcde04

Browse files
committed
Fix warnings about deprecated inclusive range syntax
1 parent 2cbbb1a commit dbcde04

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

src/lib.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ impl Error {
7171
fn new_parse_error(s: Cow<'static, str>, input: &str, offset: usize) -> Error {
7272
let context = Cow::Borrowed(input.as_bytes().get(offset..).unwrap_or(&[]));
7373
let context = if context.len() > 20 {
74-
Cow::Owned(format!("{}...", String::from_utf8_lossy(&context[..20])))
74+
Cow::Owned(format!("{}..=", String::from_utf8_lossy(&context[..20])))
7575
} else {
7676
String::from_utf8_lossy(&context)
7777
};
@@ -551,7 +551,7 @@ impl<'a> ParserState<'a> {
551551

552552
if let Ok(c) = self.get() {
553553
let symbol_type = match c {
554-
b'0'...b'4' => {
554+
b'0'..=b'4' => {
555555
// Read a variable.
556556
let kind = match c {
557557
b'0' => VarStorageKind::PrivateStatic,
@@ -719,13 +719,13 @@ impl<'a> ParserState<'a> {
719719
for _i in 0..bytes {
720720
let c = self.get()?;
721721
let byte: u8 = match c {
722-
b'0'...b'9' | b'a'...b'z' | b'A'...b'Z' | b'_' | b'$' => c,
722+
b'0'..=b'9' | b'a'..=b'z' | b'A'..=b'Z' | b'_' | b'$' => c,
723723
b'?' => {
724724
let c = self.get()?;
725725
match c {
726-
b'A'...b'Z' => c - b'A' + 0xe1,
727-
b'a'...b'z' => c - b'A' + 0xc1,
728-
b'0'...b'9' => {
726+
b'A'..=b'Z' => c - b'A' + 0xe1,
727+
b'a'..=b'z' => c - b'A' + 0xc1,
728+
b'0'..=b'9' => {
729729
let v = &[
730730
b',', b'/', b'\\', b':', b'.', b' ', b'\n', b'\t', b'\'', b'-',
731731
];
@@ -767,7 +767,7 @@ impl<'a> ParserState<'a> {
767767
// <non-negative integer> ::= <decimal digit> # when 1 <= Number <= 10
768768
// ::= <hex digit>+ @ # when Numbrer == 0 or >= 10
769769
//
770-
// <hex-digit> ::= [A-P] # A = 0, B = 1, ...
770+
// <hex-digit> ::= [A-P] # A = 0, B = 1, ..=
771771
fn read_number(&mut self) -> Result<i32> {
772772
let neg = self.consume(b"?");
773773

@@ -784,7 +784,7 @@ impl<'a> ParserState<'a> {
784784
self.advance(i + 1);
785785
return Ok(if neg { -(ret as i32) } else { ret as i32 });
786786
}
787-
b'A'...b'P' => {
787+
b'A'..=b'P' => {
788788
ret = (ret << 4) + i32::from(c - b'A');
789789
i += 1;
790790
}
@@ -815,7 +815,7 @@ impl<'a> ParserState<'a> {
815815
}
816816
}
817817

818-
// First 10 strings can be referenced by special names ?0, ?1, ..., ?9.
818+
// First 10 strings can be referenced by special names ?0, ?1, ..=, ?9.
819819
// Memorize it.
820820
fn memorize_name(&mut self, n: &Name<'a>) {
821821
// TODO: the contains check does an equality check on the Name enum, which
@@ -1666,7 +1666,7 @@ impl<'a> Serializer<'a> {
16661666
return Ok(());
16671667
}
16681668
Type::VarArgs => {
1669-
write!(self.w, "...")?;
1669+
write!(self.w, "..=")?;
16701670
return Ok(());
16711671
}
16721672
Type::Ptr(ref inner, storage_class)

0 commit comments

Comments
 (0)