@@ -57,7 +57,7 @@ fn const_bool_simple(t: T) -> Option<bool> {
5757fn const_val_simple ( a : T ) -> Result < T , String > {
5858 match const_value_simple ( & a. term ) {
5959 Some ( v) => Ok ( T :: new ( a. ty , leaf_term ( Op :: new_const ( v) ) ) ) ,
60- _ => Err ( format ! ( "{} is not a constant value" , & a) ) ,
60+ _ => Err ( format ! ( "{} is not a constant value" , a) ) ,
6161 }
6262}
6363
@@ -741,9 +741,9 @@ impl<'ast> ZGen<'ast> {
741741 let f = self
742742 . functions
743743 . get ( & f_path)
744- . ok_or_else ( || format ! ( "No file '{:?}' attempting fn call" , & f_path) ) ?
744+ . ok_or_else ( || format ! ( "No file '{:?}' attempting fn call" , f_path) ) ?
745745 . get ( & f_name)
746- . ok_or_else ( || format ! ( "No function '{}' attempting fn call" , & f_name) ) ?;
746+ . ok_or_else ( || format ! ( "No function '{}' attempting fn call" , f_name) ) ?;
747747 let arg_tys = args. iter ( ) . map ( |arg| arg. type_ ( ) . clone ( ) ) ;
748748 let generics = ZGenericInf :: < IS_CNST > :: new ( self , f, & f_path, & f_name)
749749 . unify_generic ( egv, exp_ty, arg_tys) ?;
@@ -780,7 +780,7 @@ impl<'ast> ZGen<'ast> {
780780 } ;
781781 let dur = ( time:: Instant :: now ( ) - before) . as_millis ( ) ;
782782 if dur > 50 {
783- info ! ( "{} ms to process {} {:?}" , dur, & f_name, & f_path) ;
783+ info ! ( "{} ms to process {} {:?}" , dur, f_name, f_path) ;
784784 }
785785 ret
786786 }
@@ -802,7 +802,7 @@ impl<'ast> ZGen<'ast> {
802802 generics. remove ( & gid. value ) . ok_or_else ( || {
803803 format ! (
804804 "Failed to find generic argument {} for builtin call {}" ,
805- & gid. value, & f_name,
805+ gid. value, f_name,
806806 )
807807 } )
808808 } )
@@ -814,15 +814,15 @@ impl<'ast> ZGen<'ast> {
814814 if f. generics . len ( ) != generics. len ( ) {
815815 return Err ( format ! (
816816 "Wrong number of generic params calling {} (got {}, expected {})" ,
817- & f. id. value,
817+ f. id. value,
818818 generics. len( ) ,
819819 f. generics. len( )
820820 ) ) ;
821821 }
822822 if f. parameters . len ( ) != args. len ( ) {
823823 return Err ( format ! (
824824 "Wrong nimber of arguments calling {} (got {}, expected {})" ,
825- & f. id. value,
825+ f. id. value,
826826 args. len( ) ,
827827 f. parameters. len( )
828828 ) ) ;
@@ -940,7 +940,7 @@ impl<'ast> ZGen<'ast> {
940940 } else {
941941 panic ! (
942942 "No function '{:?}//{}' attempting const_entry_fn" ,
943- & f_file, & f_name
943+ f_file, f_name
944944 )
945945 }
946946 }
@@ -952,9 +952,9 @@ impl<'ast> ZGen<'ast> {
952952 let f = self
953953 . functions
954954 . get ( & f_file)
955- . unwrap_or_else ( || panic ! ( "No file '{:?}'" , & f_file) )
955+ . unwrap_or_else ( || panic ! ( "No file '{:?}'" , f_file) )
956956 . get ( & f_name)
957- . unwrap_or_else ( || panic ! ( "No function '{}'" , & f_name) )
957+ . unwrap_or_else ( || panic ! ( "No function '{}'" , f_name) )
958958 . clone ( ) ;
959959 // XXX(unimpl) tuple returns not supported
960960 assert ! ( f. returns. len( ) <= 1 ) ;
@@ -1195,7 +1195,7 @@ impl<'ast> ZGen<'ast> {
11951195 None if IS_CNST => self . cvar_lookup ( & i. value ) . ok_or_else ( || {
11961196 format ! (
11971197 "Undefined const identifier {} in {}" ,
1198- & i. value,
1198+ i. value,
11991199 self . cur_path( ) . to_string_lossy( )
12001200 )
12011201 } ) ,
@@ -1204,7 +1204,7 @@ impl<'ast> ZGen<'ast> {
12041204 . map_err ( |e| format ! ( "{e}" ) ) ?
12051205 {
12061206 Val :: Term ( t) => Ok ( t) ,
1207- _ => Err ( format ! ( "Non-Term identifier {}" , & i. value) ) ,
1207+ _ => Err ( format ! ( "Non-Term identifier {}" , i. value) ) ,
12081208 } ,
12091209 }
12101210 }
@@ -1338,13 +1338,7 @@ impl<'ast> ZGen<'ast> {
13381338 assert ! ( !p. accesses. is_empty( ) ) ;
13391339 let ( val, accs) = if let Some ( ast:: Access :: Call ( c) ) = p. accesses . first ( ) {
13401340 let ( f_path, f_name) = self . deref_import ( & p. id . value ) ;
1341- let exp_ty = self . lhs_ty_take ( ) . and_then ( |ty| {
1342- if p. accesses . len ( ) > 1 {
1343- None
1344- } else {
1345- Some ( ty)
1346- }
1347- } ) ;
1341+ let exp_ty = self . lhs_ty_take ( ) . filter ( |_ty| p. accesses . len ( ) <= 1 ) ;
13481342 let args = c
13491343 . arguments
13501344 . expressions
@@ -1640,7 +1634,7 @@ impl<'ast> ZGen<'ast> {
16401634 . search ( & sa. id . value )
16411635 . map ( |r| r. 1 . clone ( ) )
16421636 . ok_or_else ( || {
1643- format ! ( "No such member {} of struct {nm}" , & sa. id. value)
1637+ format ! ( "No such member {} of struct {nm}" , sa. id. value)
16441638 } ) ,
16451639 ty => Err ( format ! ( "Attempted member access on non-Struct type {ty}" ) ) ,
16461640 } ,
@@ -1783,7 +1777,7 @@ impl<'ast> ZGen<'ast> {
17831777 . unwrap_or ( false )
17841778 {
17851779 self . err (
1786- format ! ( "Constant {} clashes with import of same name" , & c. id. value) ,
1780+ format ! ( "Constant {} clashes with import of same name" , c. id. value) ,
17871781 & c. span ,
17881782 ) ;
17891783 }
@@ -1816,7 +1810,7 @@ impl<'ast> ZGen<'ast> {
18161810
18171811 if let Some ( ast:: ArrayParamMetadata :: Transcript ( _) ) = & c. array_metadata {
18181812 if !value. type_ ( ) . is_array ( ) {
1819- self . err ( format ! ( "Non-array transcript {}" , & c. id. value) , & c. span ) ;
1813+ self . err ( format ! ( "Non-array transcript {}" , c. id. value) , & c. span ) ;
18201814 }
18211815 self . mark_array_as_transcript ( & c. id . value , value. clone ( ) ) ;
18221816 }
@@ -1829,7 +1823,7 @@ impl<'ast> ZGen<'ast> {
18291823 . insert ( c. id . value . clone ( ) , ( c. ty . clone ( ) , value) )
18301824 . is_some ( )
18311825 {
1832- self . err ( format ! ( "Constant {} redefined" , & c. id. value) , & c. span ) ;
1826+ self . err ( format ! ( "Constant {} redefined" , c. id. value) , & c. span ) ;
18331827 }
18341828 }
18351829
@@ -1869,7 +1863,7 @@ impl<'ast> ZGen<'ast> {
18691863 let ( def, path) = self . get_struct_or_type ( & s. id . value ) . ok_or_else ( || {
18701864 format ! (
18711865 "No such struct {} (did you bring it into scope?)" ,
1872- & s. id. value
1866+ s. id. value
18731867 )
18741868 } ) ?;
18751869 let generics = match def {
@@ -1886,7 +1880,7 @@ impl<'ast> ZGen<'ast> {
18861880 if generics. len ( ) != g_len {
18871881 return Err ( format ! (
18881882 "Struct {} is not monomorphized or wrong number of generic parameters" ,
1889- & s. id. value
1883+ s. id. value
18901884 ) ) ;
18911885 }
18921886 self . file_stack_push ( path) ;
@@ -2086,7 +2080,7 @@ impl<'ast> ZGen<'ast> {
20862080 . is_some ( )
20872081 {
20882082 self . err (
2089- format ! ( "Struct {} defined over existing name" , & s. id. value) ,
2083+ format ! ( "Struct {} defined over existing name" , s. id. value) ,
20902084 & s. span ,
20912085 ) ;
20922086 }
@@ -2111,7 +2105,7 @@ impl<'ast> ZGen<'ast> {
21112105 . is_some ( )
21122106 {
21132107 self . err (
2114- format ! ( "Type {} defined over existing name" , & t. id. value) ,
2108+ format ! ( "Type {} defined over existing name" , t. id. value) ,
21152109 & t. span ,
21162110 ) ;
21172111 }
@@ -2132,7 +2126,7 @@ impl<'ast> ZGen<'ast> {
21322126 self . err (
21332127 format ! (
21342128 "Functions must return exactly 1 value; {} returns {}" ,
2135- & f_ast. id. value,
2129+ f_ast. id. value,
21362130 f_ast. returns. len( ) ,
21372131 ) ,
21382132 & f. span ,
@@ -2164,7 +2158,7 @@ impl<'ast> ZGen<'ast> {
21642158 . insert ( f. id . value . clone ( ) , f_ast)
21652159 . is_some ( )
21662160 {
2167- self . err ( format ! ( "Function {} redefined" , & f. id. value) , & f. span ) ;
2161+ self . err ( format ! ( "Function {} redefined" , f. id. value) , & f. span ) ;
21682162 }
21692163 }
21702164 ast:: SymbolDeclaration :: Import ( _) => ( ) , // already handled in visit_imports
0 commit comments