From d3cfb7274d87c441b47c3d4790246be0a5a54e3f Mon Sep 17 00:00:00 2001 From: Antoni Boucher Date: Tue, 13 Aug 2024 14:04:38 -0400 Subject: [PATCH] Fix clippy lint --- src/builder.rs | 16 ++++++++-------- src/int.rs | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/builder.rs b/src/builder.rs index eabdf0d8342..7ab9dfee46a 100644 --- a/src/builder.rs +++ b/src/builder.rs @@ -141,7 +141,7 @@ fn compare_exchange( ) -> RValue<'gcc> { let size = get_maybe_pointer_size(src); let compare_exchange = - self.context.get_builtin_function(&format!("__atomic_compare_exchange_{}", size)); + self.context.get_builtin_function(format!("__atomic_compare_exchange_{}", size)); let order = self.context.new_rvalue_from_int(self.i32_type, order.to_gcc()); let failure_order = self.context.new_rvalue_from_int(self.i32_type, failure_order.to_gcc()); let weak = self.context.new_rvalue_from_int(self.bool_type, weak as i32); @@ -328,7 +328,7 @@ fn function_call( let result = current_func.new_local( self.location, return_type, - &format!("returnValue{}", self.next_value_counter()), + format!("returnValue{}", self.next_value_counter()), ); self.block.add_assignment( self.location, @@ -396,7 +396,7 @@ fn function_ptr_call( let result = current_func.new_local( self.location, return_value.get_type(), - &format!("ptrReturnValue{}", self.next_value_counter()), + format!("ptrReturnValue{}", self.next_value_counter()), ); self.block.add_assignment(self.location, result, return_value); result.to_rvalue() @@ -438,7 +438,7 @@ pub fn overflow_call( let result = current_func.new_local( self.location, return_type, - &format!("overflowReturnValue{}", self.next_value_counter()), + format!("overflowReturnValue{}", self.next_value_counter()), ); self.block.add_assignment( self.location, @@ -923,7 +923,7 @@ fn alloca(&mut self, size: Size, align: Align) -> RValue<'gcc> { let ty = self.cx.type_array(self.cx.type_i8(), size.bytes()).get_aligned(align.bytes()); // TODO(antoyo): It might be better to return a LValue, but fixing the rustc API is non-trivial. self.current_func() - .new_local(self.location, ty, &format!("stack_var_{}", self.next_value_counter())) + .new_local(self.location, ty, format!("stack_var_{}", self.next_value_counter())) .get_address(self.location) } @@ -949,7 +949,7 @@ fn load(&mut self, pointee_ty: Type<'gcc>, ptr: RValue<'gcc>, align: Align) -> R let loaded_value = function.new_local( self.location, aligned_type, - &format!("loadedValue{}", self.next_value_counter()), + format!("loadedValue{}", self.next_value_counter()), ); block.add_assignment(self.location, loaded_value, deref); loaded_value.to_rvalue() @@ -970,7 +970,7 @@ fn atomic_load( // TODO(antoyo): use ty. // TODO(antoyo): handle alignment. let atomic_load = - self.context.get_builtin_function(&format!("__atomic_load_{}", size.bytes())); + self.context.get_builtin_function(format!("__atomic_load_{}", size.bytes())); let ordering = self.context.new_rvalue_from_int(self.i32_type, order.to_gcc()); let volatile_const_void_ptr_type = @@ -1126,7 +1126,7 @@ fn atomic_store( ) { // TODO(antoyo): handle alignment. let atomic_store = - self.context.get_builtin_function(&format!("__atomic_store_{}", size.bytes())); + self.context.get_builtin_function(format!("__atomic_store_{}", size.bytes())); let ordering = self.context.new_rvalue_from_int(self.i32_type, order.to_gcc()); let volatile_const_void_ptr_type = self.context.new_type::<()>().make_volatile().make_pointer(); diff --git a/src/int.rs b/src/int.rs index 92d5c1cbbb8..1893d5a17dc 100644 --- a/src/int.rs +++ b/src/int.rs @@ -735,7 +735,7 @@ pub fn gcc_bswap(&mut self, mut arg: RValue<'gcc>, width: u64) -> RValue<'gcc> { // TODO(antoyo): check if it's faster to use string literals and a // match instead of format!. - let bswap = self.cx.context.get_builtin_function(&format!("__builtin_bswap{}", width)); + let bswap = self.cx.context.get_builtin_function(format!("__builtin_bswap{}", width)); // FIXME(antoyo): this cast should not be necessary. Remove // when having proper sized integer types. let param_type = bswap.get_param(0).to_rvalue().get_type();