Skip to content

Commit

Permalink
please clippy (#2573)
Browse files Browse the repository at this point in the history
  • Loading branch information
tshepang committed Jul 5, 2023
1 parent 5e95130 commit 43741d2
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 15 deletions.
7 changes: 2 additions & 5 deletions bindgen-tests/tests/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ fn create_bindgen_builder(header: &Path) -> Result<BuilderState, Error> {
.last()
.and_then(shlex::split)
.unwrap();
flags.extend(extra_flags.into_iter());
flags.extend(extra_flags);
} else if line.contains("bindgen-osx-only") {
let prepend_flags = ["--raw-line", "#![cfg(target_os=\"macos\")]"];
flags = prepend_flags
Expand Down Expand Up @@ -304,10 +304,7 @@ fn create_bindgen_builder(header: &Path) -> Result<BuilderState, Error> {
"",
];

let args = prepend
.iter()
.map(ToString::to_string)
.chain(flags.into_iter());
let args = prepend.iter().map(ToString::to_string).chain(flags);

let mut builder = builder_from_flags(args)?.0;
if let Some(ref parse_cb) = parse_callbacks {
Expand Down
10 changes: 5 additions & 5 deletions bindgen/codegen/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4912,7 +4912,7 @@ pub(crate) mod utils {

let items = vec![use_objc, id_type];
let old_items = mem::replace(result, items);
result.extend(old_items.into_iter());
result.extend(old_items);
}

pub(crate) fn prepend_block_header(
Expand All @@ -4931,7 +4931,7 @@ pub(crate) mod utils {

let items = vec![use_block];
let old_items = mem::replace(result, items);
result.extend(old_items.into_iter());
result.extend(old_items);
}

pub(crate) fn prepend_union_types(
Expand Down Expand Up @@ -5043,7 +5043,7 @@ pub(crate) mod utils {
];

let old_items = mem::replace(result, items);
result.extend(old_items.into_iter());
result.extend(old_items);
}

pub(crate) fn prepend_incomplete_array_types(
Expand Down Expand Up @@ -5119,7 +5119,7 @@ pub(crate) mod utils {
];

let old_items = mem::replace(result, items);
result.extend(old_items.into_iter());
result.extend(old_items);
}

pub(crate) fn prepend_complex_type(
Expand All @@ -5136,7 +5136,7 @@ pub(crate) mod utils {

let items = vec![complex_type];
let old_items = mem::replace(result, items);
result.extend(old_items.into_iter());
result.extend(old_items);
}

pub(crate) fn build_path(
Expand Down
10 changes: 5 additions & 5 deletions bindgen/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -912,10 +912,10 @@ impl Bindings {
/// Write these bindings as source text to the given `Write`able.
pub fn write<'a>(&self, mut writer: Box<dyn Write + 'a>) -> io::Result<()> {
if !self.options.disable_header_comment {
let version = option_env!("CARGO_PKG_VERSION");
let version =
option_env!("CARGO_PKG_VERSION").unwrap_or("(unknown version)");
let header = format!(
"/* automatically generated by rust-bindgen {} */\n\n",
version.unwrap_or("(unknown version)")
"/* automatically generated by rust-bindgen {version} */\n\n",
);
writer.write_all(header.as_bytes())?;
}
Expand Down Expand Up @@ -1244,7 +1244,7 @@ fn commandline_flag_unit_test_function() {
let bindings = crate::builder();
let command_line_flags = bindings.command_line_flags();

let test_cases = vec![
let test_cases = [
"--rust-target",
"--no-derive-default",
"--generate",
Expand All @@ -1263,7 +1263,7 @@ fn commandline_flag_unit_test_function() {
.allowlist_function("safe_function");

let command_line_flags = bindings.command_line_flags();
let test_cases = vec![
let test_cases = [
"--rust-target",
"input_header",
"--no-derive-default",
Expand Down

0 comments on commit 43741d2

Please sign in to comment.