Unnamed repository; edit this file 'description' to name the repository.
Merge pull request #22685 from jakubadamw/itertools-0.15
internal: Update itertools to 0.15
Chayim Refael Friedman 2 weeks ago
parent 65e9d46 · parent 5515540 · commit 0d381ca
-rw-r--r--Cargo.lock36
-rw-r--r--Cargo.toml2
-rw-r--r--crates/hir/src/lib.rs10
-rw-r--r--crates/ide-assists/src/handlers/replace_if_let_with_match.rs5
-rw-r--r--crates/ide-db/src/source_change.rs10
-rw-r--r--crates/ide/src/move_item.rs4
-rw-r--r--crates/rust-analyzer/src/config.rs4
-rw-r--r--crates/span/src/map.rs2
-rw-r--r--xtask/src/tidy.rs4
9 files changed, 36 insertions, 41 deletions
diff --git a/Cargo.lock b/Cargo.lock
index 399b858bc4..2a45b6ea4f 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -821,7 +821,7 @@ dependencies = [
"hir-expand",
"hir-ty",
"intern",
- "itertools 0.14.0",
+ "itertools 0.15.0",
"la-arena 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
"ra-ap-rustc_type_ir",
"rustc-hash 2.1.2",
@@ -856,7 +856,7 @@ dependencies = [
"hir-expand",
"indexmap",
"intern",
- "itertools 0.14.0",
+ "itertools 0.15.0",
"la-arena 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
"query-group-macro",
"ra-ap-rustc_abi",
@@ -888,7 +888,7 @@ dependencies = [
"either",
"expect-test",
"intern",
- "itertools 0.14.0",
+ "itertools 0.15.0",
"mbe",
"parser",
"query-group-macro",
@@ -921,7 +921,7 @@ dependencies = [
"hir-expand",
"indexmap",
"intern",
- "itertools 0.14.0",
+ "itertools 0.15.0",
"la-arena 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
"macros",
"oorandom",
@@ -1058,7 +1058,7 @@ dependencies = [
"ide-db",
"ide-diagnostics",
"ide-ssr",
- "itertools 0.14.0",
+ "itertools 0.15.0",
"macros",
"nohash-hasher",
"oorandom",
@@ -1087,7 +1087,7 @@ dependencies = [
"expect-test",
"hir",
"ide-db",
- "itertools 0.14.0",
+ "itertools 0.15.0",
"smallvec",
"stdx",
"syntax",
@@ -1105,7 +1105,7 @@ dependencies = [
"expect-test",
"hir",
"ide-db",
- "itertools 0.14.0",
+ "itertools 0.15.0",
"macros",
"smallvec",
"stdx",
@@ -1128,7 +1128,7 @@ dependencies = [
"expect-test",
"fst",
"hir",
- "itertools 0.14.0",
+ "itertools 0.15.0",
"line-index 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"macros",
"memchr",
@@ -1160,7 +1160,7 @@ dependencies = [
"expect-test",
"hir",
"ide-db",
- "itertools 0.14.0",
+ "itertools 0.15.0",
"paths",
"serde_json",
"stdx",
@@ -1178,7 +1178,7 @@ dependencies = [
"expect-test",
"hir",
"ide-db",
- "itertools 0.14.0",
+ "itertools 0.15.0",
"parser",
"syntax",
"test-fixture",
@@ -1280,9 +1280,9 @@ dependencies = [
[[package]]
name = "itertools"
-version = "0.14.0"
+version = "0.15.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2b192c782037fadd9cfa75548310488aabdbf3d2da73885b31bd0abd03351285"
+checksum = "8b4baf93f58d4425749ca49a51c50ebab072c5df6994d08fed93541c331481dc"
dependencies = [
"either",
]
@@ -1417,7 +1417,7 @@ dependencies = [
"hir-expand",
"ide-db",
"intern",
- "itertools 0.14.0",
+ "itertools 0.15.0",
"proc-macro-api",
"project-model",
"span",
@@ -1963,7 +1963,7 @@ dependencies = [
"cfg",
"expect-test",
"intern",
- "itertools 0.14.0",
+ "itertools 0.15.0",
"la-arena 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
"paths",
"rustc-hash 2.1.2",
@@ -2348,7 +2348,7 @@ dependencies = [
"ide-ssr",
"indexmap",
"intern",
- "itertools 0.14.0",
+ "itertools 0.15.0",
"load-cargo",
"lsp-server 0.7.9",
"memchr",
@@ -2693,7 +2693,7 @@ dependencies = [
"backtrace",
"crossbeam-channel",
"crossbeam-utils",
- "itertools 0.14.0",
+ "itertools 0.15.0",
"jod-thread",
"libc",
"miow",
@@ -2729,7 +2729,7 @@ version = "0.0.0"
dependencies = [
"either",
"expect-test",
- "itertools 0.14.0",
+ "itertools 0.15.0",
"parser",
"rayon",
"rowan",
@@ -3710,7 +3710,7 @@ dependencies = [
"edition",
"either",
"flate2",
- "itertools 0.14.0",
+ "itertools 0.15.0",
"proc-macro2",
"quote",
"stdx",
diff --git a/Cargo.toml b/Cargo.toml
index aceb307b0b..96ddbbb5ca 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -114,7 +114,7 @@ dot = "0.1.4"
either = "1.15.0"
expect-test = "1.5.1"
indexmap = { version = "2.9.0", features = ["serde"] }
-itertools = "0.14.0"
+itertools = "0.15.0"
libc = "0.2.172"
nohash-hasher = "0.2.0"
oorandom = "11.1.5"
diff --git a/crates/hir/src/lib.rs b/crates/hir/src/lib.rs
index f676a700cc..bbecc686b6 100644
--- a/crates/hir/src/lib.rs
+++ b/crates/hir/src/lib.rs
@@ -6849,8 +6849,8 @@ impl<'db> Layout<'db> {
.into_iter()
.flatten()
.chain(iter::once((0, self.0.size.bytes())))
- .tuple_windows()
- .filter_map(|((i, start), (_, end))| {
+ .array_windows()
+ .filter_map(|[(i, start), (_, end)]| {
let size = field_size(i)?;
end.checked_sub(start)?.checked_sub(size)
})
@@ -7381,9 +7381,9 @@ pub fn resolve_absolute_path<'a, I: Iterator<Item = Symbol> + Clone + 'a>(
let mut def_map = crate_def_map(db, krate);
let mut module = &def_map[def_map.root_module_id()];
let mut segments = segments.with_position().peekable();
- while let Some((_, segment)) = segments.next_if(|&(position, _)| {
- !matches!(position, itertools::Position::Last | itertools::Position::Only)
- }) {
+ while let Some((_, segment)) =
+ segments.next_if(|&(position, _)| !position.is_last)
+ {
let res = module
.scope
.get(&Name::new_symbol_root(segment))
diff --git a/crates/ide-assists/src/handlers/replace_if_let_with_match.rs b/crates/ide-assists/src/handlers/replace_if_let_with_match.rs
index 5225202177..a1c2641f26 100644
--- a/crates/ide-assists/src/handlers/replace_if_let_with_match.rs
+++ b/crates/ide-assists/src/handlers/replace_if_let_with_match.rs
@@ -241,9 +241,8 @@ pub(crate) fn replace_match_with_if_let(
return None;
}
- let mut arms = match_arm_list.arms();
- let (first_arm, second_arm) = (arms.next()?, arms.next()?);
- if arms.next().is_some() || second_arm.guard().is_some() {
+ let [first_arm, second_arm] = match_arm_list.arms().collect_array()?;
+ if second_arm.guard().is_some() {
return None;
}
if first_arm.guard().is_some() && ctx.edition() < Edition::Edition2024 {
diff --git a/crates/ide-db/src/source_change.rs b/crates/ide-db/src/source_change.rs
index 72683c9512..07bf294405 100644
--- a/crates/ide-db/src/source_change.rs
+++ b/crates/ide-db/src/source_change.rs
@@ -164,13 +164,9 @@ impl SnippetEdit {
.into_iter()
.zip(1..)
.with_position()
- .flat_map(|pos| {
- let (snippet, index) = match pos {
- (itertools::Position::First, it) | (itertools::Position::Middle, it) => it,
- // last/only snippet gets index 0
- (itertools::Position::Last, (snippet, _))
- | (itertools::Position::Only, (snippet, _)) => (snippet, 0),
- };
+ .flat_map(|(position, (snippet, index))| {
+ // The last/only snippet gets index 0.
+ let index = if position.is_last { 0 } else { index };
match snippet {
Snippet::Tabstop(pos) => vec![(index, TextRange::empty(pos))],
diff --git a/crates/ide/src/move_item.rs b/crates/ide/src/move_item.rs
index b5d47c83a5..1e628f4e97 100644
--- a/crates/ide/src/move_item.rs
+++ b/crates/ide/src/move_item.rs
@@ -119,12 +119,12 @@ fn swap_sibling_in_list<A: AstNode + Clone, I: Iterator<Item = A>>(
range: TextRange,
direction: Direction,
) -> Option<TextEdit> {
- let list_lookup = list.tuple_windows().find(|(l, r)| match direction {
+ let list_lookup = list.array_windows().find(|[l, r]| match direction {
Direction::Up => r.syntax().text_range().contains_range(range),
Direction::Down => l.syntax().text_range().contains_range(range),
});
- if let Some((l, r)) = list_lookup {
+ if let Some([l, r]) = list_lookup {
Some(replace_nodes(range, l.syntax(), r.syntax()))
} else {
// Cursor is beyond any movable list item (for example, on curly brace in enum).
diff --git a/crates/rust-analyzer/src/config.rs b/crates/rust-analyzer/src/config.rs
index 6bdeb8ba07..5fc17a52b9 100644
--- a/crates/rust-analyzer/src/config.rs
+++ b/crates/rust-analyzer/src/config.rs
@@ -3501,8 +3501,8 @@ impl FullConfigInput {
fields.sort_by_key(|&(x, ..)| x);
fields
.iter()
- .tuple_windows()
- .for_each(|(a, b)| assert!(a.0 != b.0, "{a:?} duplicate field"));
+ .array_windows()
+ .for_each(|[a, b]| assert!(a.0 != b.0, "{a:?} duplicate field"));
fields
}
diff --git a/crates/span/src/map.rs b/crates/span/src/map.rs
index d8309b04d4..d874b73642 100644
--- a/crates/span/src/map.rs
+++ b/crates/span/src/map.rs
@@ -30,7 +30,7 @@ impl SpanMap {
/// in order.
pub fn finish(&mut self) {
always!(
- self.spans.iter().tuple_windows().all(|(a, b)| a.0 < b.0),
+ self.spans.iter().array_windows().all(|[a, b]| a.0 < b.0),
"spans are not in order"
);
self.spans.shrink_to_fit();
diff --git a/xtask/src/tidy.rs b/xtask/src/tidy.rs
index 33145a8834..73ae70ca0e 100644
--- a/xtask/src/tidy.rs
+++ b/xtask/src/tidy.rs
@@ -205,9 +205,9 @@ fn check_test_attrs(path: &Path, text: &str) {
}
if let Some((line, _)) = text
.lines()
- .tuple_windows()
+ .array_windows()
.enumerate()
- .find(|(_, (a, b))| b.contains("#[should_panic") && !a.contains("FIXME"))
+ .find(|(_, [a, b])| b.contains("#[should_panic") && !a.contains("FIXME"))
{
panic!(
"\ndon't add `#[should_panic]` tests, see:\n\n {}\n\n {}:{line}\n",