@@ -20,19 +20,19 @@ use crate::nix_ffi;
2020
2121use crate :: {
2222 bytecode:: value:: {
23- Array , ArrayData , Container , EnumVariantData , InlineValue , NickelValue , TypeData ,
23+ Array , ArrayData , Container , EnumVariantData , NickelValue , TypeData ,
2424 ValueContent , ValueContentRef , ValueContentRefMut ,
2525 } ,
2626 cache:: InputFormat ,
2727 closurize:: Closurize ,
2828 combine:: Combine ,
29- error:: { EvalCtxt , EvalError , EvalErrorData , IllegalPolymorphicTailAction , Warning } ,
29+ error:: { EvalErrorData , IllegalPolymorphicTailAction , Warning } ,
3030 identifier:: LocIdent ,
3131 label:: { Polarity , TypeVarData , ty_path} ,
3232 metrics:: increment,
3333 mk_app, mk_fun, mk_record,
3434 parser:: utils:: parse_number_sci,
35- position:: { PosIdx , PosTable , TermPos } ,
35+ position:: { PosIdx , PosTable } ,
3636 serialize:: { self , ExportFormat } ,
3737 stdlib:: internals,
3838 term:: { make as mk_term, record:: * , string:: NickelString , * } ,
@@ -102,7 +102,7 @@ pub enum OperationCont {
102102
103103/// A string represention of the type of the first argument of serialization-related primitive
104104/// operations. This is a Nickel enum of the supported serialization formats.
105- static ENUM_FORMAT : & ' static str = "[| 'Json, 'Yaml, 'Toml |]" ;
105+ static ENUM_FORMAT : & str = "[| 'Json, 'Yaml, 'Toml |]" ;
106106
107107impl std:: fmt:: Debug for OperationCont {
108108 fn fmt ( & self , f : & mut std:: fmt:: Formatter < ' _ > ) -> std:: fmt:: Result {
@@ -315,7 +315,7 @@ impl<'ctxt, R: ImportResolver, C: Cache> VirtualMachine<'ctxt, R, C> {
315315 // _ => mk_type_error!("Label"),
316316 // }),
317317 UnaryOp :: EnumEmbed ( _id) => {
318- if let Some ( _ ) = value. as_enum_variant ( ) {
318+ if value. as_enum_variant ( ) . is_some ( ) {
319319 Ok ( value. with_pos_idx ( pos_op_inh) . into ( ) )
320320 } else {
321321 mk_type_error ! ( "Enum" )
@@ -729,13 +729,13 @@ impl<'ctxt, R: ImportResolver, C: Cache> VirtualMachine<'ctxt, R, C> {
729729 ValueContentRef :: Array ( Container :: Alloc ( array_data) ) => {
730730 let terms = seq_terms (
731731 array_data. array . iter ( ) . map ( |t| {
732- let t_with_ctr = RuntimeContract :: apply_all (
732+
733+ RuntimeContract :: apply_all (
733734 t. clone ( ) ,
734735 array_data. pending_contracts . iter ( ) . cloned ( ) ,
735736 pos. to_inherited ( & mut self . context . pos_table ) ,
736737 )
737- . closurize ( & mut self . context . cache , env. clone ( ) ) ;
738- t_with_ctr
738+ . closurize ( & mut self . context . cache , env. clone ( ) )
739739 } ) ,
740740 pos_op,
741741 ) ;
@@ -1130,7 +1130,7 @@ impl<'ctxt, R: ImportResolver, C: Cache> VirtualMachine<'ctxt, R, C> {
11301130 } )
11311131 } else {
11321132 Ok ( Closure {
1133- value : NickelValue :: enum_tag ( tag, pos_op_inh) . into ( ) ,
1133+ value : NickelValue :: enum_tag ( tag, pos_op_inh) ,
11341134 env,
11351135 } )
11361136 }
@@ -1237,7 +1237,7 @@ impl<'ctxt, R: ImportResolver, C: Cache> VirtualMachine<'ctxt, R, C> {
12371237 }
12381238 UnaryOp :: Trace => {
12391239 if let Some ( s) = value. as_string ( ) {
1240- let _ = writeln ! ( self . context. trace, "std.trace: {}" , s ) ;
1240+ let _ = writeln ! ( self . context. trace, "std.trace: {s}" ) ;
12411241 Ok ( ( ) )
12421242 } else {
12431243 mk_type_error ! ( "String" )
@@ -1312,7 +1312,7 @@ impl<'ctxt, R: ImportResolver, C: Cache> VirtualMachine<'ctxt, R, C> {
13121312 let arg = NickelValue :: thunk ( Thunk :: new ( arg_clos) , arg_pos) ;
13131313
13141314 Ok ( NickelValue :: enum_variant (
1315- LocIdent :: new ( & tag) . with_pos ( self . context . pos_table . get ( pos) ) ,
1315+ LocIdent :: new ( tag) . with_pos ( self . context . pos_table . get ( pos) ) ,
13161316 Some ( arg) ,
13171317 pos_op_inh,
13181318 )
@@ -1327,7 +1327,7 @@ impl<'ctxt, R: ImportResolver, C: Cache> VirtualMachine<'ctxt, R, C> {
13271327 UnaryOp :: EnumIsVariant => Ok ( NickelValue :: bool_value (
13281328 value
13291329 . as_enum_variant ( )
1330- . map_or ( false , |enum_variant| enum_variant. arg . is_some ( ) ) ,
1330+ . is_some_and ( |enum_variant| enum_variant. arg . is_some ( ) ) ,
13311331 pos_op_inh,
13321332 )
13331333 . into ( ) ) ,
@@ -1452,7 +1452,7 @@ impl<'ctxt, R: ImportResolver, C: Cache> VirtualMachine<'ctxt, R, C> {
14521452 }
14531453 // The stack should already contain the default label to attach, so push
14541454 // the (potential) error data.
1455- self . stack . push_arg ( Closure { value : value , env } , pos_arg) ;
1455+ self . stack . push_arg ( Closure { value, env } , pos_arg) ;
14561456
14571457 Ok ( Closure {
14581458 value : internals:: add_default_check_label ( ) ,
@@ -1770,7 +1770,7 @@ impl<'ctxt, R: ImportResolver, C: Cache> VirtualMachine<'ctxt, R, C> {
17701770 return mk_type_error ! ( "String" , 2 , value2) ;
17711771 } ;
17721772
1773- Ok ( NickelValue :: string ( format ! ( "{}{}" , s1 , s2 ) , pos_op_inh) . into ( ) )
1773+ Ok ( NickelValue :: string ( format ! ( "{s1}{s2}" ) , pos_op_inh) . into ( ) )
17741774 }
17751775 BinaryOp :: ContractApply | BinaryOp :: ContractCheck => {
17761776 // Performing only one match `if let Term::Type` and putting the call to
@@ -2340,7 +2340,7 @@ impl<'ctxt, R: ImportResolver, C: Cache> VirtualMachine<'ctxt, R, C> {
23402340 )
23412341 {
23422342 match record. sealed_tail . as_ref ( ) {
2343- Some ( t) if t. has_dyn_field ( & id) => {
2343+ Some ( t) if t. has_dyn_field ( id) => {
23442344 Err ( EvalErrorData :: IllegalPolymorphicTailAccess {
23452345 action : IllegalPolymorphicTailAction :: FieldRemove {
23462346 field : id. to_string ( ) ,
@@ -2948,19 +2948,19 @@ impl<'ctxt, R: ImportResolver, C: Cache> VirtualMachine<'ctxt, R, C> {
29482948 fields : IndexMap :: from ( [
29492949 (
29502950 LocIdent :: from ( "left_only" ) ,
2951- Field :: from ( NickelValue :: from ( left_only) ) ,
2951+ Field :: from ( left_only) ,
29522952 ) ,
29532953 (
29542954 LocIdent :: from ( "left_center" ) ,
2955- Field :: from ( NickelValue :: from ( left_center) ) ,
2955+ Field :: from ( left_center) ,
29562956 ) ,
29572957 (
29582958 LocIdent :: from ( "right_center" ) ,
2959- Field :: from ( NickelValue :: from ( right_center) ) ,
2959+ Field :: from ( right_center) ,
29602960 ) ,
29612961 (
29622962 LocIdent :: from ( "right_only" ) ,
2963- Field :: from ( NickelValue :: from ( right_only) ) ,
2963+ Field :: from ( right_only) ,
29642964 ) ,
29652965 ] ) ,
29662966 attrs : RecordAttrs :: default ( ) ,
@@ -3180,7 +3180,7 @@ impl<'ctxt, R: ImportResolver, C: Cache> VirtualMachine<'ctxt, R, C> {
31803180 expected : expected. to_owned ( ) ,
31813181 arg_number,
31823182 pos_arg,
3183- arg_evaluated : arg_evaluated ,
3183+ arg_evaluated,
31843184 pos_op,
31853185 } )
31863186 } ;
0 commit comments