@@ -88,15 +88,15 @@ impl CompileTimeEnv {
8888 pub fn get_builtin_index ( & self , name : & str ) -> Option < ( & BuiltinFn , u8 ) > {
8989 let index = self . builtins . iter ( ) . position ( |x| x. name == name) ;
9090
91- let result = index . map ( |i| ( self . builtins . get ( i ) . unwrap ( ) , i as u8 ) ) ;
92- result
91+
92+ index . map ( |i| ( self . builtins . get ( i ) . unwrap ( ) , i as u8 ) )
9393 }
9494
9595 pub fn get_user_builtin_index ( & self , name : & str ) -> Option < ( & BuiltinFn , u8 ) > {
9696 let index = self . user_builtins . iter ( ) . position ( |x| x. name == name) ;
9797
98- let result = index . map ( |i| ( self . user_builtins . get ( i ) . unwrap ( ) , i as u8 ) ) ;
99- result
98+
99+ index . map ( |i| ( self . user_builtins . get ( i ) . unwrap ( ) , i as u8 ) )
100100 }
101101
102102 pub fn add_user_builtins ( & mut self , builtins : Vec < BuiltinFn < ' static > > ) {
@@ -122,38 +122,38 @@ impl CompileTimeEnv {
122122 }
123123
124124 pub fn get_var_index ( & self , name : & str ) -> Option < usize > {
125- let index = self
125+
126+
127+ self
126128 . vars
127129 . iter ( )
128- . position ( |context_name| context_name == name) ;
129-
130- index
130+ . position ( |context_name| context_name == name)
131131 }
132132
133133 pub fn get_prompt ( & self , index : usize ) -> Option < & String > {
134134 self . prompts . get ( index)
135135 }
136136
137137 pub fn get_prompt_index ( & self , name : & str ) -> Option < usize > {
138- let index = self
138+
139+
140+ self
139141 . prompts
140142 . iter ( )
141- . position ( |context_name| context_name == name) ;
142-
143- index
143+ . position ( |context_name| context_name == name)
144144 }
145145
146146 pub fn get_secret ( & self , index : usize ) -> Option < & String > {
147147 self . secrets . get ( index)
148148 }
149149
150150 pub fn get_secret_index ( & self , name : & str ) -> Option < usize > {
151- let index = self
151+
152+
153+ self
152154 . secrets
153155 . iter ( )
154- . position ( |context_name| context_name == name) ;
155-
156- index
156+ . position ( |context_name| context_name == name)
157157 }
158158
159159 pub fn get_client_context ( & self , index : usize ) -> Option < & String > {
@@ -177,8 +177,8 @@ impl CompileTimeEnv {
177177 . iter ( )
178178 . position ( |context_name| context_name == name) ;
179179
180- let result = index . map ( |i| ( self . client_context . get ( i ) . unwrap ( ) , i as u8 ) ) ;
181- result
180+
181+ index . map ( |i| ( self . client_context . get ( i ) . unwrap ( ) , i as u8 ) )
182182 }
183183}
184184
@@ -292,7 +292,7 @@ fn compile_expr(
292292 codes. push ( CONSTANT ) ;
293293 codes. push ( index as u8 ) ;
294294 } else {
295- constants. push ( Value :: Number ( number. 0 . clone ( ) ) ) ;
295+ constants. push ( Value :: Number ( number. 0 ) ) ;
296296 let index = constants. len ( ) - 1 ;
297297 codes. push ( CONSTANT ) ;
298298 codes. push ( index as u8 ) ;
@@ -367,7 +367,7 @@ fn compile_expr(
367367 }
368368 } ;
369369
370- if let None = result {
370+ if result. is_none ( ) {
371371 errs. push ( identifier_undefined_err) ;
372372 }
373373 }
0 commit comments