Skip to content

Commit

Permalink
Fix stable clippy warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
bilelmoussaoui committed May 12, 2024
1 parent 0507e8f commit 445bae3
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/analysis/enums.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ pub fn new(env: &Env, obj: &GObject, imports: &mut Imports) -> Option<Info> {
.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 {:?}",
Expand Down
2 changes: 1 addition & 1 deletion src/analysis/flags.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ pub fn new(env: &Env, obj: &GObject, imports: &mut Imports) -> Option<Info> {
.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 {:?}",
Expand Down
2 changes: 1 addition & 1 deletion src/analysis/function_parameters.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
}
Expand Down
6 changes: 4 additions & 2 deletions src/analysis/functions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion src/analysis/rust_type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
2 changes: 1 addition & 1 deletion src/codegen/function_body_chunk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
2 changes: 1 addition & 1 deletion src/codegen/return_value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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}"),
Expand Down
2 changes: 1 addition & 1 deletion src/library_postprocessing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ impl Library {
return;
}
if let Some(s) = c_types.get(&tid) {
*c_type = s.clone();
c_type.clone_from(s);
}
}

Expand Down

0 comments on commit 445bae3

Please sign in to comment.