mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 12:29:21 +00:00
fix: Add missing fields diagnostic fix for patterns
This commit is contained in:
parent
1da2d82f58
commit
dd3f7664fd
4 changed files with 184 additions and 62 deletions
|
@ -555,6 +555,10 @@ pub fn record_pat_field(name_ref: ast::NameRef, pat: ast::Pat) -> ast::RecordPat
|
|||
ast_from_text(&format!("fn f(S {{ {}: {} }}: ()))", name_ref, pat))
|
||||
}
|
||||
|
||||
pub fn record_pat_field_shorthand(name_ref: ast::NameRef) -> ast::RecordPatField {
|
||||
ast_from_text(&format!("fn f(S {{ {} }}: ()))", name_ref))
|
||||
}
|
||||
|
||||
/// Returns a `BindPat` if the path has just one segment, a `PathPat` otherwise.
|
||||
pub fn path_pat(path: ast::Path) -> ast::Pat {
|
||||
return from_text(&path.to_string());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue