Skip to content

Commit 3432ef4

Browse files
committed
Auto merge of #17481 - roife:fix-issue-17480, r=Veykril
fix: pattern completions in let-stmt fix #17480. We can write `let S { a, b } = s;` or `let Some(x) = a else {}`, so it is reasonable to allow pattern completions in `LetStmt`.
2 parents db69df3 + 291e96a commit 3432ef4

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

crates/ide-completion/src/context/analysis.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1334,7 +1334,7 @@ fn pattern_context_for(
13341334
.map_or((PatternRefutability::Irrefutable, false), |node| {
13351335
let refutability = match_ast! {
13361336
match node {
1337-
ast::LetStmt(let_) => return (PatternRefutability::Irrefutable, let_.ty().is_some()),
1337+
ast::LetStmt(let_) => return (PatternRefutability::Refutable, let_.ty().is_some()),
13381338
ast::Param(param) => {
13391339
let has_type_ascription = param.ty().is_some();
13401340
param_ctx = (|| {

crates/ide-completion/src/tests/pattern.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ enum SingleVariantEnum {
146146
}
147147
use SingleVariantEnum::Variant;
148148
fn foo() {
149-
let a$0
149+
for a$0
150150
}
151151
"#,
152152
expect![[r#"

0 commit comments

Comments
 (0)