@@ -13,7 +13,7 @@ use crate::parser::{
13
13
span:: Span ,
14
14
ParserInput , ParserResult ,
15
15
} ;
16
- use num:: { BigInt , Num } ;
16
+ use num:: { BigInt , Num } ;
17
17
18
18
/// Define a different type for each prefix token
19
19
#[ derive( Assoc , Debug , Clone , Copy , PartialEq , Eq ) ]
@@ -32,7 +32,6 @@ enum Encoding {
32
32
}
33
33
34
34
impl Encoding {
35
-
36
35
/// Returns the base of each encoding type
37
36
pub fn radix ( & self ) -> u32 {
38
37
match self {
@@ -48,6 +47,7 @@ impl Encoding {
48
47
pub struct EncodedNumber < ' a > {
49
48
/// [Span] associated with this node
50
49
span : Span < ' a > ,
50
+
51
51
/// The prefix of the encoded number
52
52
prefix : Encoding ,
53
53
/// The suffix of the encoded number
@@ -64,7 +64,6 @@ pub enum EncodedNumberValue {
64
64
}
65
65
66
66
impl < ' a > EncodedNumber < ' a > {
67
-
68
67
/// Removes the binary prefix (0b) and returns the binary suffix
69
68
fn parse_binary ( input : ParserInput < ' a > ) -> ParserResult < ' a , ( Encoding , Token < ' a > ) > {
70
69
preceded ( Token :: binary_prefix, Token :: bin_number) ( input)
@@ -96,7 +95,7 @@ impl<'a> EncodedNumber<'a> {
96
95
// Otherwise, return string representation of the decoded number
97
96
if let Ok ( integer) = <i64 >:: from_str_radix ( suffix, nr_encoding) {
98
97
return EncodedNumberValue :: Integer ( integer) ;
99
- } else if let Ok ( bigint) = < BigInt as Num > :: from_str_radix ( suffix, nr_encoding) {
98
+ } else if let Ok ( bigint) = BigInt :: from_str_radix ( suffix, nr_encoding) {
100
99
return EncodedNumberValue :: Large ( bigint. to_string ( ) ) ;
101
100
}
102
101
EncodedNumberValue :: Large ( string)
0 commit comments