diff --git a/Cargo.lock b/Cargo.lock index 4e88c224f5..838657521b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -43,7 +43,6 @@ dependencies = [ "clang-sys", "clap", "clap_complete", - "itertools", "log", "prettyplease", "proc-macro2", @@ -187,12 +186,6 @@ dependencies = [ "os_str_bytes", ] -[[package]] -name = "either" -version = "1.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" - [[package]] name = "env_logger" version = "0.8.4" @@ -307,15 +300,6 @@ dependencies = [ "windows-sys 0.52.0", ] -[[package]] -name = "itertools" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186" -dependencies = [ - "either", -] - [[package]] name = "libc" version = "0.2.167" diff --git a/Cargo.toml b/Cargo.toml index 248c041378..4ed7eaa578 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -31,7 +31,6 @@ clang-sys = "1" clap = "4" clap_complete = "4" env_logger = "0.10.0" -itertools = { version = ">=0.10,<0.14", default-features = false } libloading = "0.8" log = "0.4" objc = "0.2" diff --git a/bindgen/Cargo.toml b/bindgen/Cargo.toml index c01f8f0c44..38cc84997a 100644 --- a/bindgen/Cargo.toml +++ b/bindgen/Cargo.toml @@ -32,7 +32,6 @@ cexpr.workspace = true clang-sys = { workspace = true, features = ["clang_11_0"] } clap = { workspace = true, features = ["derive"], optional = true } clap_complete = { workspace = true, optional = true } -itertools = { workspace = true } log = { workspace = true, optional = true } prettyplease = { workspace = true, optional = true, features = ["verbatim"] } proc-macro2.workspace = true diff --git a/bindgen/ir/comp.rs b/bindgen/ir/comp.rs index 1dd074ba4d..6cb89df6df 100644 --- a/bindgen/ir/comp.rs +++ b/bindgen/ir/comp.rs @@ -1,7 +1,5 @@ //! Compound types (unions and structs) in our intermediate representation. -use itertools::Itertools; - use super::analysis::Sizedness; use super::annotations::Annotations; use super::context::{BindgenContext, FunctionId, ItemId, TypeId, VarId}; @@ -19,6 +17,7 @@ use crate::HashMap; use crate::NonCopyUnionStyle; use std::cmp; use std::io; +use std::iter; use std::mem; /// The kind of compound type. @@ -491,23 +490,20 @@ where loop { // While we have plain old data members, just keep adding them to our - // resulting fields. We introduce a scope here so that we can use - // `raw_fields` again after the `by_ref` iterator adaptor is dropped. - { - let non_bitfields = raw_fields - .by_ref() - .peeking_take_while(|f| f.bitfield_width().is_none()) - .map(|f| Field::DataMember(f.0)); - fields.extend(non_bitfields); - } + // resulting fields. + let non_bitfields = iter::from_fn(|| { + raw_fields.next_if(|f| f.bitfield_width().is_none()) + }) + .map(|f| Field::DataMember(f.0)); + fields.extend(non_bitfields); // Now gather all the consecutive bitfields. Only consecutive bitfields // may potentially share a bitfield allocation unit with each other in // the Itanium C++ ABI. - let mut bitfields = raw_fields - .by_ref() - .peeking_take_while(|f| f.bitfield_width().is_some()) - .peekable(); + let mut bitfields = iter::from_fn(|| { + raw_fields.next_if(|f| f.bitfield_width().is_some()) + }) + .peekable(); if bitfields.peek().is_none() { break;