mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-30 13:51:31 +00:00
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`.
This commit is contained in:
commit
3432ef4414
2 changed files with 2 additions and 2 deletions
|
@ -1334,7 +1334,7 @@ fn pattern_context_for(
|
||||||
.map_or((PatternRefutability::Irrefutable, false), |node| {
|
.map_or((PatternRefutability::Irrefutable, false), |node| {
|
||||||
let refutability = match_ast! {
|
let refutability = match_ast! {
|
||||||
match node {
|
match node {
|
||||||
ast::LetStmt(let_) => return (PatternRefutability::Irrefutable, let_.ty().is_some()),
|
ast::LetStmt(let_) => return (PatternRefutability::Refutable, let_.ty().is_some()),
|
||||||
ast::Param(param) => {
|
ast::Param(param) => {
|
||||||
let has_type_ascription = param.ty().is_some();
|
let has_type_ascription = param.ty().is_some();
|
||||||
param_ctx = (|| {
|
param_ctx = (|| {
|
||||||
|
|
|
@ -146,7 +146,7 @@ enum SingleVariantEnum {
|
||||||
}
|
}
|
||||||
use SingleVariantEnum::Variant;
|
use SingleVariantEnum::Variant;
|
||||||
fn foo() {
|
fn foo() {
|
||||||
let a$0
|
for a$0
|
||||||
}
|
}
|
||||||
"#,
|
"#,
|
||||||
expect![[r#"
|
expect![[r#"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue