Rollup merge of #149390 - lnicola:sync-from-ra, r=lnicola `rust-analyzer` subtree update Subtree update of `rust-analyzer` to https://github.com/rust-lang/rust-analyzer/commit/a2a4a9525a44d955613e83a0f8707c7dc46ea855. Created using https://github.com/rust-lang/josh-sync. r? `@ghost`
diff --git a/crates/hir-expand/src/builtin/fn_macro.rs b/crates/hir-expand/src/builtin/fn_macro.rs index 6fe63f2..78fac8f 100644 --- a/crates/hir-expand/src/builtin/fn_macro.rs +++ b/crates/hir-expand/src/builtin/fn_macro.rs
@@ -786,7 +786,8 @@ && let DelimiterKind::Parenthesis | DelimiterKind::Invisible = sub.delimiter.kind { tt = - tt_iter.exactly_one().map_err(|_| sub.delimiter.open.cover(sub.delimiter.close))?; + // FIXME: rewrite in terms of `#![feature(exact_length_collection)]`. See: #149266 + Itertools::exactly_one(tt_iter).map_err(|_| sub.delimiter.open.cover(sub.delimiter.close))?; } match tt {
diff --git a/crates/ide-assists/src/handlers/convert_bool_then.rs b/crates/ide-assists/src/handlers/convert_bool_then.rs index 9d5d3f2..91cee59 100644 --- a/crates/ide-assists/src/handlers/convert_bool_then.rs +++ b/crates/ide-assists/src/handlers/convert_bool_then.rs
@@ -163,7 +163,8 @@ let name_ref = ctx.find_node_at_offset::<ast::NameRef>()?; let mcall = name_ref.syntax().parent().and_then(ast::MethodCallExpr::cast)?; let receiver = mcall.receiver()?; - let closure_body = mcall.arg_list()?.args().exactly_one().ok()?; + // FIXME: rewrite in terms of `#![feature(exact_length_collection)]`. See: #149266 + let closure_body = Itertools::exactly_one(mcall.arg_list()?.args()).ok()?; let closure_body = match closure_body { ast::Expr::ClosureExpr(expr) => expr.body()?, _ => return None,
diff --git a/crates/ide-assists/src/handlers/convert_range_for_to_while.rs b/crates/ide-assists/src/handlers/convert_range_for_to_while.rs index 68cb764..ba577b2 100644 --- a/crates/ide-assists/src/handlers/convert_range_for_to_while.rs +++ b/crates/ide-assists/src/handlers/convert_range_for_to_while.rs
@@ -113,7 +113,7 @@ (range.start()?, range.end(), make::expr_literal("1").into(), inclusive) } ast::Expr::MethodCallExpr(call) if call.name_ref()?.text() == "step_by" => { - let [step] = call.arg_list()?.args().collect_array()?; + let [step] = Itertools::collect_array(call.arg_list()?.args())?; let (start, end, _, inclusive) = extract_range(&call.receiver()?)?; (start, end, step, inclusive) }
diff --git a/crates/ide-completion/src/tests/raw_identifiers.rs b/crates/ide-completion/src/tests/raw_identifiers.rs index 00977ea..66b1668 100644 --- a/crates/ide-completion/src/tests/raw_identifiers.rs +++ b/crates/ide-completion/src/tests/raw_identifiers.rs
@@ -8,9 +8,8 @@ let completions = completion_list_with_config_raw(TEST_CONFIG, ra_fixture, true, None); let (db, position) = position(ra_fixture); let mut actual = db.file_text(position.file_id).text(&db).to_string(); - completions - .into_iter() - .exactly_one() + // FIXME: rewrite in terms of `#![feature(exact_length_collection)]`. See: #149266 + Itertools::exactly_one(completions.into_iter()) .expect("more than one completion") .text_edit .apply(&mut actual);
diff --git a/crates/rust-analyzer/tests/slow-tests/support.rs b/crates/rust-analyzer/tests/slow-tests/support.rs index 3464a96..b1b428e 100644 --- a/crates/rust-analyzer/tests/slow-tests/support.rs +++ b/crates/rust-analyzer/tests/slow-tests/support.rs
@@ -113,7 +113,8 @@ let mut buf = Vec::new(); flags::Lsif::run( flags::Lsif { - path: tmp_dir_path.join(self.roots.iter().exactly_one().unwrap()).into(), + // FIXME: rewrite in terms of `#![feature(exact_length_collection)]`. See: #149266 + path: tmp_dir_path.join(Itertools::exactly_one(self.roots.iter()).unwrap()).into(), exclude_vendored_libraries: false, }, &mut buf,