File tree Expand file tree Collapse file tree 1 file changed +10
-10
lines changed Expand file tree Collapse file tree 1 file changed +10
-10
lines changed Original file line number Diff line number Diff line change @@ -582,34 +582,34 @@ impl Cursor<'_> {
582
582
let mut base = Base::Decimal;
583
583
if first_digit == '0' {
584
584
// Attempt to parse encoding base.
585
- let has_digits = match self.first() {
585
+ match self.first() {
586
586
'b' => {
587
587
base = Base::Binary;
588
588
self.bump();
589
- self.eat_decimal_digits()
589
+ if !self.eat_decimal_digits() {
590
+ return Int { base, empty_int: true };
591
+ }
590
592
}
591
593
'o' => {
592
594
base = Base::Octal;
593
595
self.bump();
594
- self.eat_decimal_digits()
596
+ if !self.eat_decimal_digits() {
597
+ return Int { base, empty_int: true };
598
+ }
595
599
}
596
600
'x' => {
597
601
base = Base::Hexadecimal;
598
602
self.bump();
599
- self.eat_hexadecimal_digits()
603
+ if !self.eat_hexadecimal_digits() {
604
+ return Int { base, empty_int: true };
605
+ }
600
606
}
601
607
// Not a base prefix.
602
608
'0'..='9' | '_' | '.' | 'e' | 'E' => {
603
609
self.eat_decimal_digits();
604
- true
605
610
}
606
611
// Just a 0.
607
612
_ => return Int { base, empty_int: false },
608
- };
609
- // Base prefix was provided, but there were no digits
610
- // after it, e.g. "0x".
611
- if !has_digits {
612
- return Int { base, empty_int: true };
613
613
}
614
614
} else {
615
615
// No base prefix, parse number in the usual way.
You can’t perform that action at this time.
0 commit comments