@@ -350,7 +350,7 @@ pub mod result {
350
350
}
351
351
352
352
pub fn walk_binding < V : Visitor < Ident > , Ident > ( visitor : & mut V , binding : Binding < Ident > ) -> Binding < Ident > {
353
- let Binding { name : name , expression : expression } = binding;
353
+ let Binding { name, expression } = binding;
354
354
Binding {
355
355
name : name,
356
356
expression : visitor. visit_expr ( expression)
@@ -383,7 +383,7 @@ pub mod result {
383
383
}
384
384
385
385
pub fn walk_alternative < V : Visitor < Ident > , Ident > ( visitor : & mut V , alt : Alternative < Ident > ) -> Alternative < Ident > {
386
- let Alternative { pattern : pattern , expression : expression } = alt;
386
+ let Alternative { pattern, expression } = alt;
387
387
Alternative { pattern : visitor. visit_pattern ( pattern) , expression : visitor. visit_expr ( expression) }
388
388
}
389
389
}
@@ -434,51 +434,51 @@ pub mod translate {
434
434
fn translate_module_ < ' a > ( translator : & mut Translator < ' a > , module : module:: Module < Name > ) -> Module < Id < Name > > {
435
435
let module:: Module { name : _name,
436
436
imports : _imports,
437
- bindings : bindings ,
438
- typeDeclarations : _typeDeclarations ,
439
- newtypes : newtypes ,
440
- classes : classes ,
441
- instances : instances ,
442
- dataDefinitions : dataDefinitions ,
437
+ bindings,
438
+ type_declarations : _type_declarations ,
439
+ newtypes,
440
+ classes,
441
+ instances,
442
+ data_definitions ,
443
443
fixity_declarations : _fixity_declarations
444
444
} = module;
445
445
446
446
let mut new_instances: Vec < Instance < Id < Name > > > = Vec :: new ( ) ;
447
447
448
448
let classes2 : Vec < Class < Id > > = classes. into_iter ( ) . map ( |class| {
449
449
let module:: Class {
450
- constraints : cs ,
451
- name : name ,
452
- variable : var ,
453
- declarations : decls ,
454
- bindings : bindings
450
+ constraints,
451
+ name,
452
+ variable,
453
+ declarations,
454
+ bindings
455
455
} = class;
456
456
Class {
457
- constraints : cs ,
457
+ constraints : constraints ,
458
458
name : name,
459
- variable : var ,
460
- declarations : decls ,
459
+ variable : variable ,
460
+ declarations : declarations ,
461
461
bindings : translator. translate_bindings ( bindings)
462
462
}
463
463
} ) . collect ( ) ;
464
464
465
465
for instance in instances. into_iter ( ) {
466
466
let module:: Instance {
467
- classname : classname ,
468
- typ : instance_type ,
469
- constraints : constraints ,
470
- bindings : bindings
467
+ classname,
468
+ typ,
469
+ constraints,
470
+ bindings
471
471
} = instance;
472
472
let bs: Vec < Binding < Id < Name > > > = translator. translate_bindings ( bindings) . into_iter ( ) . collect ( ) ;
473
473
new_instances. push ( Instance {
474
474
constraints : constraints,
475
- typ : instance_type ,
475
+ typ : typ ,
476
476
classname : classname,
477
477
bindings : bs
478
478
} ) ;
479
479
}
480
480
let bs: Vec < Binding < Id < Name > > > = translator. translate_bindings ( bindings) . into_iter ( ) . collect ( ) ;
481
- for data in dataDefinitions . iter ( ) {
481
+ for data in data_definitions . iter ( ) {
482
482
generate_deriving ( & mut new_instances, data) ;
483
483
}
484
484
for instance in new_instances. iter_mut ( ) {
@@ -491,7 +491,7 @@ pub mod translate {
491
491
}
492
492
Module {
493
493
classes : classes2,
494
- data_definitions : dataDefinitions ,
494
+ data_definitions : data_definitions ,
495
495
newtypes : newtypes,
496
496
bindings : bs,
497
497
instances : new_instances
@@ -516,7 +516,7 @@ pub mod translate {
516
516
. collect ( ) ;
517
517
typ. constraints = vec_context;
518
518
}
519
- let Qualified { value : typ, constraints : constraints } = typ;
519
+ let Qualified { value : typ, constraints } = typ;
520
520
let default_name = module:: encode_binding_identifier ( instance. classname . name , decl. name . name ) ;
521
521
let typ_name = module:: extract_applied_type ( & instance. typ ) . ctor ( ) . name ;
522
522
let instance_fn_name = module:: encode_binding_identifier ( typ_name, decl. name . name ) ;
@@ -546,7 +546,7 @@ impl <'a> Translator<'a> {
546
546
_ => false
547
547
} ;
548
548
if is_lambda {
549
- let module:: TypedExpr { typ : typ , expr : expr, ..} = input_expr;
549
+ let module:: TypedExpr { typ, expr, ..} = input_expr;
550
550
match expr {
551
551
module:: Expr :: Lambda ( arg, body) => {
552
552
//TODO need to make unique names for the lambdas created here
@@ -569,7 +569,7 @@ impl <'a> Translator<'a> {
569
569
}
570
570
571
571
fn translate_expr_rest ( & mut self , input_expr : module:: TypedExpr < Name > ) -> Expr < Id < Name > > {
572
- let module:: TypedExpr { typ : typ , expr : expr, ..} = input_expr;
572
+ let module:: TypedExpr { typ, expr, ..} = input_expr;
573
573
match expr {
574
574
module:: Expr :: Identifier ( s) => Identifier ( Id :: new ( s, typ, vec ! [ ] ) ) ,
575
575
module:: Expr :: Apply ( func, arg) => Apply ( box self . translate_expr ( * func) , box self . translate_expr ( * arg) ) ,
@@ -744,7 +744,7 @@ impl <'a> Translator<'a> {
744
744
let mut vec = Vec :: new ( ) ;
745
745
let dummy_var = & [ Id :: new ( self . name_supply . anonymous ( ) , Type :: new_var ( intern ( "a" ) ) , vec ! [ ] ) ] ;
746
746
let uid = self . name_supply . next_id ( ) ;
747
- for module:: Alternative { pattern : pattern , matches : matches , where_bindings : where_bindings } in alts. into_iter ( ) {
747
+ for module:: Alternative { pattern, matches, where_bindings } in alts. into_iter ( ) {
748
748
let bindings = where_bindings. map_or ( Vec :: new ( ) , |bs| self . translate_bindings ( bs) ) ;
749
749
vec. push ( ( self . unwrap_patterns ( uid, dummy_var, & [ pattern. node ] ) , bindings, matches) ) ;
750
750
}
@@ -765,10 +765,11 @@ impl <'a> Translator<'a> {
765
765
//then we do a simple translation to preserve the names for the arguments.
766
766
if bindings. len ( ) == 1 && simple_binding ( & bindings[ 0 ] ) {
767
767
let module:: Binding {
768
- name : name,
769
- arguments : arguments, matches : matches,
770
- typ : module:: Qualified { constraints : constraints, value : typ, } ,
771
- where_bindings : where_bindings
768
+ name,
769
+ arguments,
770
+ matches,
771
+ typ : module:: Qualified { constraints, value : typ, } ,
772
+ where_bindings
772
773
} = bindings. pop ( ) . unwrap ( ) ;
773
774
let arg_iterator = arguments. into_iter ( ) . map ( |p| {
774
775
match p {
@@ -812,9 +813,9 @@ impl <'a> Translator<'a> {
812
813
let uid = self . name_supply . next_id ( ) ;
813
814
let equations: Vec < _ > = bindings. into_iter ( ) . map ( |bind| {
814
815
let module:: Binding {
815
- arguments : arguments ,
816
- matches : matches ,
817
- where_bindings : where_bindings ,
816
+ arguments,
817
+ matches,
818
+ where_bindings,
818
819
..
819
820
} = bind;
820
821
let where_bindings_binds = where_bindings. map_or ( Vec :: new ( ) , |bs| self . translate_bindings ( bs) ) ;
0 commit comments