diff --git a/src/analysis/enums.rs b/src/analysis/enums.rs index eff7dd4bc..197b2b659 100644 --- a/src/analysis/enums.rs +++ b/src/analysis/enums.rs @@ -87,7 +87,7 @@ pub fn new(env: &Env, obj: &GObject, imports: &mut Imports) -> Option { .unwrap(); if let TransformationType::ToGlibScalar { name, .. } = &mut t.transformation_type { - *name = "self".to_owned(); + "self".clone_into(name); } else { panic!( "Enumeration function instance param must be passed as scalar, not {:?}", diff --git a/src/analysis/flags.rs b/src/analysis/flags.rs index b238d7020..d512fada0 100644 --- a/src/analysis/flags.rs +++ b/src/analysis/flags.rs @@ -83,7 +83,7 @@ pub fn new(env: &Env, obj: &GObject, imports: &mut Imports) -> Option { .unwrap(); if let TransformationType::ToGlibScalar { name, .. } = &mut t.transformation_type { - *name = "self".to_owned(); + "self".clone_into(name); } else { panic!( "Bitfield function instance param must be passed as scalar, not {:?}", diff --git a/src/analysis/function_parameters.rs b/src/analysis/function_parameters.rs index 88fcc1397..d97509506 100644 --- a/src/analysis/function_parameters.rs +++ b/src/analysis/function_parameters.rs @@ -128,7 +128,7 @@ impl TransformationType { pub fn set_to_glib_extra(&mut self, to_glib_extra_: &str) { if let Self::ToGlibPointer { to_glib_extra, .. } = self { - *to_glib_extra = to_glib_extra_.to_owned(); + to_glib_extra_.clone_into(to_glib_extra); } } } diff --git a/src/analysis/functions.rs b/src/analysis/functions.rs index 8b201e044..c8ed4e1a7 100644 --- a/src/analysis/functions.rs +++ b/src/analysis/functions.rs @@ -307,7 +307,7 @@ fn find_callback_bound_to_destructor( for call in callbacks { if call.destroy_index == destroy_index { destroy.nullable = call.nullable; - destroy.bound_name = call.bound_name.clone(); + destroy.bound_name.clone_from(&call.bound_name); return true; } } @@ -512,7 +512,9 @@ fn analyze_callbacks( for (pos, typ) in to_replace { let ty = env.library.type_(typ); params[pos].typ = typ; - params[pos].c_type = ty.get_glib_name().unwrap().to_owned(); + ty.get_glib_name() + .unwrap() + .clone_into(&mut params[pos].c_type); } let mut s = to_remove .iter() diff --git a/src/analysis/rust_type.rs b/src/analysis/rust_type.rs index 142076845..b67529936 100644 --- a/src/analysis/rust_type.rs +++ b/src/analysis/rust_type.rs @@ -242,7 +242,7 @@ impl<'env> RustTypeBuilder<'env> { mut self, callback_parameters_config: &[CallbackParameter], ) -> Self { - self.callback_parameters_config = callback_parameters_config.to_owned(); + callback_parameters_config.clone_into(&mut self.callback_parameters_config); self } diff --git a/src/codegen/function_body_chunk.rs b/src/codegen/function_body_chunk.rs index fa916b22c..d9182e3cf 100644 --- a/src/codegen/function_body_chunk.rs +++ b/src/codegen/function_body_chunk.rs @@ -124,7 +124,7 @@ impl Builder { } pub fn transformations(&mut self, transformations: &[Transformation]) -> &mut Self { - self.transformations = transformations.to_owned(); + transformations.clone_into(&mut self.transformations); self } diff --git a/src/codegen/return_value.rs b/src/codegen/return_value.rs index 42f1112ee..c5912e97a 100644 --- a/src/codegen/return_value.rs +++ b/src/codegen/return_value.rs @@ -38,7 +38,7 @@ impl ToReturnValue for library::Parameter { && self.direction == library::ParameterDirection::Return && is_gstring(&name) { - name = "String".to_owned(); + "String".clone_into(&mut name); } let type_str = match ConversionType::of(env, self.typ) { ConversionType::Unknown => format!("/*Unknown conversion*/{name}"), diff --git a/src/library_postprocessing.rs b/src/library_postprocessing.rs index 11747c6f5..efe083e9e 100644 --- a/src/library_postprocessing.rs +++ b/src/library_postprocessing.rs @@ -88,7 +88,7 @@ impl Library { return; } if let Some(s) = c_types.get(&tid) { - *c_type = s.clone(); + c_type.clone_from(s); } }