From 386d438e173f4c505798361d46f901c7a56567fb Mon Sep 17 00:00:00 2001
From: Johann Hemmann <johann.hemmann@code.berlin>
Date: Mon, 22 Jan 2024 00:42:46 +0100
Subject: [PATCH] skip_while_next

---
 Cargo.toml                                    | 1 -
 crates/ide-completion/src/context/analysis.rs | 3 +--
 2 files changed, 1 insertion(+), 3 deletions(-)

diff --git a/Cargo.toml b/Cargo.toml
index d5f9740c6de..099ac296e4d 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -179,7 +179,6 @@ new_without_default = "allow"
 non_canonical_clone_impl = "allow"
 non_canonical_partial_ord_impl = "allow"
 self_named_constructors = "allow"
-skip_while_next = "allow"
 too_many_arguments = "allow"
 toplevel_ref_arg = "allow"
 type_complexity = "allow"
diff --git a/crates/ide-completion/src/context/analysis.rs b/crates/ide-completion/src/context/analysis.rs
index 65ecaf6bac5..c06b64df1c5 100644
--- a/crates/ide-completion/src/context/analysis.rs
+++ b/crates/ide-completion/src/context/analysis.rs
@@ -1267,8 +1267,7 @@ fn pattern_context_for(
     pat
         .syntax()
         .ancestors()
-        .skip_while(|it| ast::Pat::can_cast(it.kind()))
-        .next()
+        .find(|it| !ast::Pat::can_cast(it.kind()))
         .map_or((PatternRefutability::Irrefutable, false), |node| {
             let refutability = match_ast! {
                 match node {