@@ -9,7 +9,7 @@ pub enum Token {
9
9
}
10
10
11
11
impl Display for Token {
12
- fn fmt ( & self , f : & mut Formatter ) -> std:: fmt:: Result {
12
+ fn fmt ( & self , f : & mut Formatter < ' _ > ) -> std:: fmt:: Result {
13
13
match self {
14
14
Token :: Literal ( literal) => write ! ( f, "{}" , literal) ,
15
15
Token :: Variable ( variable) => write ! ( f, "{}" , variable) ,
@@ -130,17 +130,17 @@ pub fn tokenize(s: &str) -> Token {
130
130
let mut op = ch. to_string ( ) ;
131
131
iter. next ( ) ;
132
132
if let Some ( & next_ch) = iter. peek ( ) {
133
- if ( ch == '=' && ( next_ch == '=' || next_ch == '>' ) ) ||
134
- ( ch == '&' && next_ch == '&' ) ||
135
- ( ch == '|' && next_ch == '|' ) ||
136
- ( ch == '<' && next_ch == '=' ) ||
137
- ( ch == '>' && next_ch == '=' ) ||
138
- ( ch == '!' && next_ch == '=' ) ||
139
- ( ch == '+' && next_ch == '+' ) ||
140
- ( ch == '-' && next_ch == '-' ) ||
141
- ( ch == '*' && next_ch == '*' ) ||
142
- ( ch == '>' && next_ch == '>' ) ||
143
- ( ch == '<' && next_ch == '<' )
133
+ if ( ch == '=' && ( next_ch == '=' || next_ch == '>' ) )
134
+ || ( ch == '&' && next_ch == '&' )
135
+ || ( ch == '|' && next_ch == '|' )
136
+ || ( ch == '<' && next_ch == '=' )
137
+ || ( ch == '>' && next_ch == '=' )
138
+ || ( ch == '!' && next_ch == '=' )
139
+ || ( ch == '+' && next_ch == '+' )
140
+ || ( ch == '-' && next_ch == '-' )
141
+ || ( ch == '*' && next_ch == '*' )
142
+ || ( ch == '>' && next_ch == '>' )
143
+ || ( ch == '<' && next_ch == '<' )
144
144
{
145
145
op. push ( next_ch) ;
146
146
iter. next ( ) ;
@@ -174,7 +174,7 @@ pub fn tokenize(s: &str) -> Token {
174
174
Token :: Expression ( tokens)
175
175
}
176
176
177
- fn parse_literal ( iter : & mut std:: iter:: Peekable < std:: str:: Chars > ) -> String {
177
+ fn parse_literal ( iter : & mut std:: iter:: Peekable < std:: str:: Chars < ' _ > > ) -> String {
178
178
let mut literal = String :: new ( ) ;
179
179
180
180
while let Some ( & ch) = iter. peek ( ) {
@@ -188,9 +188,9 @@ fn parse_literal(iter: &mut std::iter::Peekable<std::str::Chars>) -> String {
188
188
}
189
189
190
190
// literal validation
191
- if literal. starts_with ( "0x" ) &&
192
- literal. len ( ) > 2 &&
193
- literal[ 2 ..] . chars ( ) . all ( |c| c. is_ascii_hexdigit ( ) )
191
+ if literal. starts_with ( "0x" )
192
+ && literal. len ( ) > 2
193
+ && literal[ 2 ..] . chars ( ) . all ( |c| c. is_ascii_hexdigit ( ) )
194
194
{
195
195
return literal;
196
196
}
@@ -200,7 +200,7 @@ fn parse_literal(iter: &mut std::iter::Peekable<std::str::Chars>) -> String {
200
200
String :: from ( "0" )
201
201
}
202
202
203
- fn parse_variable ( iter : & mut std:: iter:: Peekable < std:: str:: Chars > ) -> String {
203
+ fn parse_variable ( iter : & mut std:: iter:: Peekable < std:: str:: Chars < ' _ > > ) -> String {
204
204
let mut variable = String :: new ( ) ;
205
205
while let Some ( & ch) = iter. peek ( ) {
206
206
match ch {
@@ -214,7 +214,7 @@ fn parse_variable(iter: &mut std::iter::Peekable<std::str::Chars>) -> String {
214
214
variable
215
215
}
216
216
217
- fn consume_parentheses ( iter : & mut std:: iter:: Peekable < std:: str:: Chars > ) -> String {
217
+ fn consume_parentheses ( iter : & mut std:: iter:: Peekable < std:: str:: Chars < ' _ > > ) -> String {
218
218
let mut expression = String :: new ( ) ;
219
219
let mut parentheses_count = 1 ;
220
220
0 commit comments