Skip to content

Commit

Permalink
chore: Fix clippy lints.
Browse files Browse the repository at this point in the history
  • Loading branch information
emilio committed May 7, 2024
1 parent ca78140 commit cdf7d2f
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 11 deletions.
2 changes: 2 additions & 0 deletions src/bindgen/cargo/cargo_lock.rs
Expand Up @@ -11,8 +11,10 @@ use std::path::Path;
/// Possible errors that can occur during Cargo.toml parsing.
pub enum Error {
/// Error during reading of Cargo.toml
#[allow(dead_code)]
Io(io::Error),
/// Deserialization error
#[allow(dead_code)]
Toml(toml::de::Error),
}

Expand Down
10 changes: 5 additions & 5 deletions src/bindgen/cdecl.rs
Expand Up @@ -102,7 +102,7 @@ impl CDecl {
layout,
never_return: f.never_return,
});
self.deprecated = f.annotations.deprecated.clone();
self.deprecated.clone_from(&f.annotations.deprecated);
self.build_type(&f.ret, false, config);
}

Expand All @@ -115,21 +115,21 @@ impl CDecl {
"error generating cdecl for {:?}",
t
);
self.type_qualifers = "const".to_owned();
"const".clone_into(&mut self.type_qualifers);
}

assert!(
self.type_name.is_empty(),
"error generating cdecl for {:?}",
t
);
self.type_name = generic.export_name().to_owned();
generic.export_name().clone_into(&mut self.type_name);
assert!(
self.type_generic_args.is_empty(),
"error generating cdecl for {:?}",
t
);
self.type_generic_args = generic.generics().to_owned();
generic.generics().clone_into(&mut self.type_generic_args);
self.type_ctype = generic.ctype().cloned();
}
Type::Primitive(ref p) => {
Expand All @@ -139,7 +139,7 @@ impl CDecl {
"error generating cdecl for {:?}",
t
);
self.type_qualifers = "const".to_owned();
"const".clone_into(&mut self.type_qualifers);
}

assert!(
Expand Down
2 changes: 1 addition & 1 deletion src/bindgen/config.rs
Expand Up @@ -370,7 +370,7 @@ impl ExportConfig {

pub(crate) fn rename(&self, item_name: &mut String) {
if let Some(name) = self.rename.get(item_name) {
*item_name = name.clone();
item_name.clone_from(name);
if self.renaming_overrides_prefixing {
return;
}
Expand Down
4 changes: 2 additions & 2 deletions src/bindgen/ir/constant.rs
Expand Up @@ -132,7 +132,7 @@ impl Literal {
ref mut fields,
} => {
if path.replace_self_with(self_ty) {
*export_name = self_ty.name().to_owned();
self_ty.name().clone_into(export_name);
}
for ref mut expr in fields.values_mut() {
expr.replace_self_with(self_ty);
Expand All @@ -151,7 +151,7 @@ impl Literal {
} => {
if let Some((ref mut path, ref mut export_name)) = *associated_to {
if path.replace_self_with(self_ty) {
*export_name = self_ty.name().to_owned();
self_ty.name().clone_into(export_name);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/bindgen/ir/generic_path.rs
Expand Up @@ -211,7 +211,7 @@ impl GenericPath {

pub fn replace_self_with(&mut self, self_ty: &Path) {
if self.path.replace_self_with(self_ty) {
self.export_name = self_ty.name().to_owned();
self_ty.name().clone_into(&mut self.export_name);
}
// Caller deals with generics.
}
Expand Down
2 changes: 1 addition & 1 deletion src/bindgen/mangle.rs
Expand Up @@ -140,7 +140,7 @@ impl<'a> Mangler<'a> {

fn mangle_internal(&mut self) {
debug_assert!(self.output.is_empty());
self.output = self.input.to_owned();
self.input.clone_into(&mut self.output);
if self.generic_values.is_empty() {
return;
}
Expand Down
2 changes: 1 addition & 1 deletion src/bindgen/parser.rs
Expand Up @@ -480,7 +480,7 @@ impl Parse {
self.typedefs.extend_with(&other.typedefs);
self.functions.extend_from_slice(&other.functions);
self.source_files.extend_from_slice(&other.source_files);
self.package_version = other.package_version.clone();
self.package_version.clone_from(&other.package_version);
}

fn load_syn_crate_mod<'a>(
Expand Down

0 comments on commit cdf7d2f

Please sign in to comment.