Skip to content

Fix some clippy warnings #2216

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/bindgen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
uses: actions-rs/cargo@v1
with:
command: clippy
args: -- --cfg test
args: --tests

msrv:
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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('-', "_")
);
}
4 changes: 1 addition & 3 deletions src/codegen/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4078,9 +4078,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)
Expand Down
8 changes: 4 additions & 4 deletions src/ir/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion src/ir/item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1894,7 +1894,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(
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down