summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDarren Kulp <darren@kulp.ch>2022-06-03 20:05:33 -0400
committerEmilio Cobos Álvarez <emilio@crisal.io>2022-06-05 19:39:25 +0200
commit11f3b37faf5635bf005da3645b8f3bdcaab208dc (patch)
tree035d293473cd6f080dbb978d485a6c587060ce32
parent24252f0876217d18b0ef291446fd7545d0b90bf1 (diff)
Fix some clippy warnings
cargo clippy --fix --tests cargo +nightly fmt
-rw-r--r--build.rs2
-rw-r--r--src/codegen/mod.rs4
-rw-r--r--src/ir/context.rs8
-rw-r--r--src/ir/item.rs2
-rw-r--r--src/lib.rs2
5 files changed, 8 insertions, 10 deletions
diff --git a/build.rs b/build.rs
index fcc0bb22..8c05d59b 100644
--- a/build.rs
+++ b/build.rs
@@ -85,6 +85,6 @@ fn main() {
);
println!(
"cargo:rerun-if-env-changed=BINDGEN_EXTRA_CLANG_ARGS_{}",
- std::env::var("TARGET").unwrap().replace("-", "_")
+ std::env::var("TARGET").unwrap().replace('-', "_")
);
}
diff --git a/src/codegen/mod.rs b/src/codegen/mod.rs
index 4dd52036..eee9f098 100644
--- a/src/codegen/mod.rs
+++ b/src/codegen/mod.rs
@@ -4095,9 +4095,7 @@ fn objc_method_codegen(
let body = if method.is_class_method() {
let class_name = ctx.rust_ident(
- class_name
- .expect("Generating a class method without class name?")
- .to_owned(),
+ class_name.expect("Generating a class method without class name?"),
);
quote! {
msg_send!(class!(#class_name), #methods_and_args)
diff --git a/src/ir/context.rs b/src/ir/context.rs
index 9cf43ec3..3bfe549b 100644
--- a/src/ir/context.rs
+++ b/src/ir/context.rs
@@ -597,7 +597,7 @@ If you encounter an error missing from this list, please file an issue or a PR!"
/// Returns the pointer width to use for the target for the current
/// translation.
pub fn target_pointer_size(&self) -> usize {
- return self.target_info.pointer_width / 8;
+ self.target_info.pointer_width / 8
}
/// Get the stack of partially parsed types that we are in the middle of
@@ -836,9 +836,9 @@ If you encounter an error missing from this list, please file an issue or a PR!"
)
{
let mut s = name.to_owned();
- s = s.replace("@", "_");
- s = s.replace("?", "_");
- s = s.replace("$", "_");
+ s = s.replace('@', "_");
+ s = s.replace('?', "_");
+ s = s.replace('$', "_");
s.push('_');
return Cow::Owned(s);
}
diff --git a/src/ir/item.rs b/src/ir/item.rs
index 6ce42017..3b15cd6e 100644
--- a/src/ir/item.rs
+++ b/src/ir/item.rs
@@ -1899,7 +1899,7 @@ impl ClangItemParser for Item {
// See tests/headers/const_tparam.hpp and
// tests/headers/variadic_tname.hpp.
- let name = ty_spelling.replace("const ", "").replace(".", "");
+ let name = ty_spelling.replace("const ", "").replace('.', "");
let id = with_id.unwrap_or_else(|| ctx.next_item_id());
let item = Item::new(
diff --git a/src/lib.rs b/src/lib.rs
index 0742217f..3d09ab71 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -2714,7 +2714,7 @@ fn get_target_dependent_env_var(var: &str) -> Option<String> {
return Some(v);
}
if let Ok(v) =
- env::var(&format!("{}_{}", var, target.replace("-", "_")))
+ env::var(&format!("{}_{}", var, target.replace('-', "_")))
{
return Some(v);
}