@@ -225,7 +225,7 @@ impl<'a, 'gcc, 'tcx> Builder<'a, 'gcc, 'tcx> {
225225
226226 let mut on_stack_param_indices = FxHashSet :: default ( ) ;
227227 if let Some ( indices) = self . on_stack_params . borrow ( ) . get ( & gcc_func) {
228- on_stack_param_indices = indices . clone ( ) ;
228+ on_stack_param_indices. clone_from ( indices ) ;
229229 }
230230
231231 if all_args_match {
@@ -256,8 +256,8 @@ impl<'a, 'gcc, 'tcx> Builder<'a, 'gcc, 'tcx> {
256256 actual_val. dereference ( self . location ) . to_rvalue ( )
257257 } else {
258258 assert ! (
259- ! ( ( actual_ty . is_vector( ) && !expected_ty . is_vector( ) )
260- || ( !actual_ty . is_vector( ) && expected_ty . is_vector( ) ) ) ,
259+ ( !expected_ty . is_vector( ) || actual_ty . is_vector( ) )
260+ && ( expected_ty . is_vector( ) || !actual_ty . is_vector( ) ) ,
261261 "{:?} ({}) -> {:?} ({}), index: {:?}[{}]" ,
262262 actual_ty,
263263 actual_ty. is_vector( ) ,
@@ -277,8 +277,8 @@ impl<'a, 'gcc, 'tcx> Builder<'a, 'gcc, 'tcx> {
277277 . collect ( ) ;
278278
279279 // NOTE: to take into account variadic functions.
280- for i in casted_args . len ( ) ..args . len ( ) {
281- casted_args. push ( args [ i ] ) ;
280+ for arg in args . iter ( ) . skip ( casted_args . len ( ) ) {
281+ casted_args. push ( * arg ) ;
282282 }
283283
284284 Cow :: Owned ( casted_args)
@@ -353,15 +353,15 @@ impl<'a, 'gcc, 'tcx> Builder<'a, 'gcc, 'tcx> {
353353 let function_address_names = self . function_address_names . borrow ( ) ;
354354 let original_function_name = function_address_names. get ( & func_ptr) ;
355355 llvm:: adjust_intrinsic_arguments (
356- & self ,
356+ self ,
357357 gcc_func,
358358 args. into ( ) ,
359359 & func_name,
360360 original_function_name,
361361 )
362362 } ;
363363 let args_adjusted = args. len ( ) != previous_arg_count;
364- let args = self . check_ptr_call ( "call" , func_ptr, & * args) ;
364+ let args = self . check_ptr_call ( "call" , func_ptr, & args) ;
365365
366366 // gccjit requires to use the result of functions, even when it's not used.
367367 // That's why we assign the result to a local or call add_eval().
@@ -373,7 +373,7 @@ impl<'a, 'gcc, 'tcx> Builder<'a, 'gcc, 'tcx> {
373373 unsafe { RETURN_VALUE_COUNT += 1 } ;
374374 let return_value = self . cx . context . new_call_through_ptr ( self . location , func_ptr, & args) ;
375375 let return_value = llvm:: adjust_intrinsic_return_value (
376- & self ,
376+ self ,
377377 return_value,
378378 & func_name,
379379 & args,
@@ -441,7 +441,7 @@ impl<'a, 'gcc, 'tcx> Builder<'a, 'gcc, 'tcx> {
441441 self . block . add_assignment (
442442 self . location ,
443443 result,
444- self . cx . context . new_call ( self . location , func, & args) ,
444+ self . cx . context . new_call ( self . location , func, args) ,
445445 ) ;
446446 result. to_rvalue ( )
447447 }
@@ -595,7 +595,7 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> {
595595 ) -> RValue < ' gcc > {
596596 let try_block = self . current_func ( ) . new_block ( "try" ) ;
597597
598- let current_block = self . block . clone ( ) ;
598+ let current_block = self . block ;
599599 self . block = try_block;
600600 let call = self . call ( typ, fn_attrs, None , func, args, None ) ; // TODO(antoyo): use funclet here?
601601 self . block = current_block;
@@ -1176,7 +1176,7 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> {
11761176 // NOTE: due to opaque pointers now being used, we need to cast here.
11771177 let ptr = self . context . new_cast ( self . location , ptr, typ. make_pointer ( ) ) ;
11781178 // NOTE: array indexing is always considered in bounds in GCC (TODO(antoyo): to be verified).
1179- let mut indices = indices. into_iter ( ) ;
1179+ let mut indices = indices. iter ( ) ;
11801180 let index = indices. next ( ) . expect ( "first index in inbounds_gep" ) ;
11811181 let mut result = self . context . new_array_access ( self . location , ptr, * index) ;
11821182 for index in indices {
@@ -1684,7 +1684,7 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> {
16841684
16851685 fn zext ( & mut self , value : RValue < ' gcc > , dest_typ : Type < ' gcc > ) -> RValue < ' gcc > {
16861686 // FIXME(antoyo): this does not zero-extend.
1687- if value. get_type ( ) . is_bool ( ) && dest_typ. is_i8 ( & self . cx ) {
1687+ if value. get_type ( ) . is_bool ( ) && dest_typ. is_i8 ( self . cx ) {
16881688 // FIXME(antoyo): hack because base::from_immediate converts i1 to i8.
16891689 // Fix the code in codegen_ssa::base::from_immediate.
16901690 return value;
@@ -2057,7 +2057,7 @@ impl<'a, 'gcc, 'tcx> Builder<'a, 'gcc, 'tcx> {
20572057 self . context . new_rvalue_from_vector ( self . location , mask_type, & vector_elements) ;
20582058 let shifted = self . context . new_rvalue_vector_perm ( self . location , res, res, mask) ;
20592059 shift *= 2 ;
2060- res = op ( res, shifted, & self . context ) ;
2060+ res = op ( res, shifted, self . context ) ;
20612061 }
20622062 self . context
20632063 . new_vector_access ( self . location , res, self . context . new_rvalue_zero ( self . int_type ) )
@@ -2073,7 +2073,7 @@ impl<'a, 'gcc, 'tcx> Builder<'a, 'gcc, 'tcx> {
20732073 }
20742074
20752075 pub fn vector_reduce_op ( & mut self , src : RValue < ' gcc > , op : BinaryOp ) -> RValue < ' gcc > {
2076- let loc = self . location . clone ( ) ;
2076+ let loc = self . location ;
20772077 self . vector_reduce ( src, |a, b, context| context. new_binary_op ( loc, op, a. get_type ( ) , a, b) )
20782078 }
20792079
@@ -2090,7 +2090,6 @@ impl<'a, 'gcc, 'tcx> Builder<'a, 'gcc, 'tcx> {
20902090 let vector_type = src. get_type ( ) . unqualified ( ) . dyncast_vector ( ) . expect ( "vector type" ) ;
20912091 let element_count = vector_type. get_num_units ( ) ;
20922092 ( 0 ..element_count)
2093- . into_iter ( )
20942093 . map ( |i| {
20952094 self . context
20962095 . new_vector_access (
@@ -2121,7 +2120,6 @@ impl<'a, 'gcc, 'tcx> Builder<'a, 'gcc, 'tcx> {
21212120 let vector_type = src. get_type ( ) . unqualified ( ) . dyncast_vector ( ) . expect ( "vector type" ) ;
21222121 let element_count = vector_type. get_num_units ( ) ;
21232122 ( 0 ..element_count)
2124- . into_iter ( )
21252123 . map ( |i| {
21262124 self . context
21272125 . new_vector_access (
@@ -2141,7 +2139,7 @@ impl<'a, 'gcc, 'tcx> Builder<'a, 'gcc, 'tcx> {
21412139
21422140 // Inspired by Hacker's Delight min implementation.
21432141 pub fn vector_reduce_min ( & mut self , src : RValue < ' gcc > ) -> RValue < ' gcc > {
2144- let loc = self . location . clone ( ) ;
2142+ let loc = self . location ;
21452143 self . vector_reduce ( src, |a, b, context| {
21462144 let differences_or_zeros = difference_or_zero ( loc, a, b, context) ;
21472145 context. new_binary_op ( loc, BinaryOp :: Plus , b. get_type ( ) , b, differences_or_zeros)
@@ -2150,7 +2148,7 @@ impl<'a, 'gcc, 'tcx> Builder<'a, 'gcc, 'tcx> {
21502148
21512149 // Inspired by Hacker's Delight max implementation.
21522150 pub fn vector_reduce_max ( & mut self , src : RValue < ' gcc > ) -> RValue < ' gcc > {
2153- let loc = self . location . clone ( ) ;
2151+ let loc = self . location ;
21542152 self . vector_reduce ( src, |a, b, context| {
21552153 let differences_or_zeros = difference_or_zero ( loc, a, b, context) ;
21562154 context. new_binary_op ( loc, BinaryOp :: Minus , a. get_type ( ) , a, differences_or_zeros)
@@ -2345,7 +2343,7 @@ impl<'tcx> HasParamEnv<'tcx> for Builder<'_, '_, 'tcx> {
23452343
23462344impl < ' tcx > HasTargetSpec for Builder < ' _ , ' _ , ' tcx > {
23472345 fn target_spec ( & self ) -> & Target {
2348- & self . cx . target_spec ( )
2346+ self . cx . target_spec ( )
23492347 }
23502348}
23512349
0 commit comments