diff --git a/Cargo.lock b/Cargo.lock index 792f5c92a..598dc49e0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -252,7 +252,6 @@ dependencies = [ "hashbrown", "humansize", "ignore", - "itertools 0.11.0", "lazy_static", "libc", "libmimalloc-sys", @@ -492,15 +491,6 @@ dependencies = [ "either", ] -[[package]] -name = "itertools" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1c173a5686ce8bfa551b3563d0c2170bf24ca44da99c7ca4bfdab5418c3fe57" -dependencies = [ - "either", -] - [[package]] name = "itoa" version = "1.0.10" @@ -673,7 +663,7 @@ checksum = "59230a63c37f3e18569bdb90e4a89cbf5bf8b06fea0b84e65ea10cc4df47addd" dependencies = [ "difflib", "float-cmp", - "itertools 0.10.5", + "itertools", "normalize-line-endings", "predicates-core", "regex", diff --git a/Cargo.toml b/Cargo.toml index c94430aed..bcc50c3fe 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -36,7 +36,6 @@ pkg-fmt = "zip" [dependencies] regex = "1.10.4" clap = { version = "4.0.0", features = ["cargo", "env", "wrap_help", "string"] } -itertools = "0.11.0" typed-arena = "2.0.2" rustc-hash = "2.0.0" strsim = "0.10.0" diff --git a/src/diff/dijkstra.rs b/src/diff/dijkstra.rs index c79eaa90c..55ffc3f9c 100644 --- a/src/diff/dijkstra.rs +++ b/src/diff/dijkstra.rs @@ -4,7 +4,6 @@ use std::{cmp::Reverse, env}; use bumpalo::Bump; -use itertools::Itertools; use radix_heap::RadixHeapMap; use crate::{ @@ -240,7 +239,7 @@ pub(crate) fn mark_syntax<'a>( ) }) .take(print_length) - .collect_vec() + .collect::>() ); populate_change_map(&route, change_map); @@ -249,7 +248,6 @@ pub(crate) fn mark_syntax<'a>( #[cfg(test)] mod tests { - use itertools::Itertools; use line_numbers::SingleLineSpan; use typed_arena::Arena; @@ -282,7 +280,7 @@ mod tests { let vertex_arena = Bump::new(); let route = shortest_path(start, &vertex_arena, 0, DEFAULT_GRAPH_LIMIT).unwrap(); - let actions = route.iter().map(|(action, _)| *action).collect_vec(); + let actions = route.iter().map(|(action, _)| *action).collect::>(); assert_eq!( actions, vec![UnchangedNode { @@ -324,7 +322,7 @@ mod tests { let vertex_arena = Bump::new(); let route = shortest_path(start, &vertex_arena, 0, DEFAULT_GRAPH_LIMIT).unwrap(); - let actions = route.iter().map(|(action, _)| *action).collect_vec(); + let actions = route.iter().map(|(action, _)| *action).collect::>(); assert_eq!( actions, vec![ @@ -366,7 +364,7 @@ mod tests { let vertex_arena = Bump::new(); let route = shortest_path(start, &vertex_arena, 0, DEFAULT_GRAPH_LIMIT).unwrap(); - let actions = route.iter().map(|(action, _)| *action).collect_vec(); + let actions = route.iter().map(|(action, _)| *action).collect::>(); assert_eq!( actions, vec![ @@ -412,7 +410,7 @@ mod tests { let vertex_arena = Bump::new(); let route = shortest_path(start, &vertex_arena, 0, DEFAULT_GRAPH_LIMIT).unwrap(); - let actions = route.iter().map(|(action, _)| *action).collect_vec(); + let actions = route.iter().map(|(action, _)| *action).collect::>(); assert_eq!( actions, vec![ @@ -453,7 +451,7 @@ mod tests { let vertex_arena = Bump::new(); let route = shortest_path(start, &vertex_arena, 0, DEFAULT_GRAPH_LIMIT).unwrap(); - let actions = route.iter().map(|(action, _)| *action).collect_vec(); + let actions = route.iter().map(|(action, _)| *action).collect::>(); assert_eq!( actions, vec![ReplacedComment { @@ -485,7 +483,7 @@ mod tests { let vertex_arena = Bump::new(); let route = shortest_path(start, &vertex_arena, 0, DEFAULT_GRAPH_LIMIT).unwrap(); - let actions = route.iter().map(|(action, _)| *action).collect_vec(); + let actions = route.iter().map(|(action, _)| *action).collect::>(); assert_eq!( actions, vec![ReplacedComment { @@ -525,7 +523,7 @@ mod tests { let vertex_arena = Bump::new(); let route = shortest_path(start, &vertex_arena, 0, DEFAULT_GRAPH_LIMIT).unwrap(); - let actions = route.iter().map(|(action, _)| *action).collect_vec(); + let actions = route.iter().map(|(action, _)| *action).collect::>(); assert_eq!( actions, vec![ diff --git a/src/options.rs b/src/options.rs index 517b00ff2..2f524f4e6 100644 --- a/src/options.rs +++ b/src/options.rs @@ -9,7 +9,6 @@ use std::{ use clap::{crate_authors, crate_description, value_parser, Arg, ArgAction, Command}; use crossterm::tty::IsTty; -use itertools::Itertools; use crate::{ display::style::BackgroundColor, @@ -612,19 +611,20 @@ fn parse_overrides_or_die(raw_overrides: &[String]) -> Vec<(LanguageOverride, Ve std::process::exit(EXIT_BAD_ARGUMENTS); } - overrides - .into_iter() - .coalesce( - |(prev_lang, mut prev_globs), (current_lang, current_globs)| { - if prev_lang == current_lang { - prev_globs.extend(current_globs); - Ok((prev_lang, prev_globs)) - } else { - Err(((prev_lang, prev_globs), (current_lang, current_globs))) - } - }, - ) - .collect() + let mut combined_overrides: Vec<(LanguageOverride, Vec)> = vec![]; + for (lang, globs) in overrides { + if let Some((prev_lang, prev_globs)) = combined_overrides.last_mut() { + if *prev_lang == lang { + prev_globs.extend(globs); + } else { + combined_overrides.push((lang, globs)); + } + } else { + combined_overrides.push((lang, globs)); + } + } + + combined_overrides } /// Parse CLI arguments passed to the binary.