diff --git a/host/Cargo.toml b/host/Cargo.toml index d75c8624..93e36219 100644 --- a/host/Cargo.toml +++ b/host/Cargo.toml @@ -51,7 +51,7 @@ hashbrown = { version = "0.17", default-features = false, features = ["inline-mo indoc = "2" inline-snap = { path = "inline-snap" } inline-snap-macro = { path = "inline-snap-macro" } -itertools = { version = "0.14", default-features = false } +itertools = { version = "0.15", default-features = false } js-bindgen-cli-lib = { path = "cli-lib" } js-bindgen-ld-shared = { path = "ld-shared" } js-bindgen-shared = { path = "shared" } diff --git a/host/cli-lib/src/lib.rs b/host/cli-lib/src/lib.rs index 48e1f2aa..0f6ff164 100644 --- a/host/cli-lib/src/lib.rs +++ b/host/cli-lib/src/lib.rs @@ -6,7 +6,7 @@ use std::ops::Deref; use anyhow::Result; use foldhash::fast::FixedState; use hashbrown::HashMap; -use itertools::{Itertools, Position}; +use itertools::Itertools; use serde::{Deserialize, Serialize}; use wasmparser::MemoryType; @@ -77,7 +77,7 @@ impl + Display + Eq + Hash + Serialize> JsOutput<'_, T> { write!(output, "\t\t\t\t'{name}': ")?; for (position, line) in js.lines().with_position() { - if let Position::Middle | Position::Last = position { + if position.is_middle() || position.is_last() { if line.is_empty() { output.write_all(b"\n")?; } else { @@ -113,7 +113,7 @@ impl + Display + Eq + Hash + Serialize> JsOutput<'_, T> { write!(output, "\t\t\t\t'{name}': ")?; for (position, line) in js.lines().with_position() { - if let Position::Middle | Position::Last = position { + if position.is_middle() || position.is_last() { if line.is_empty() { output.write_all(b"\n")?; } else { diff --git a/host/inline-snap/src/lib.rs b/host/inline-snap/src/lib.rs index f7c1bd3f..7c856bb9 100644 --- a/host/inline-snap/src/lib.rs +++ b/host/inline-snap/src/lib.rs @@ -6,7 +6,7 @@ use std::{fs, mem}; use dtor::dtor; use hashbrown::HashMap; pub use inline_snap_macro::inline_snap; -use itertools::{Itertools, Position}; +use itertools::Itertools; #[doc(hidden)] pub use prettyplease; #[doc(hidden)] @@ -189,13 +189,11 @@ fn normalize_output(r#type: Type, input: &str, level: usize) -> String { } for (position, mut line) in input.split_inclusive('\n').with_position() { - if let Position::Middle | Position::Last = position - && !line.trim_end().is_empty() - { + if (position.is_middle() || position.is_last()) && !line.trim_end().is_empty() { out.push_str(&tabs); } - if let Position::Last = position { + if position.is_last() { line = line.trim_end(); }