mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-30 22:01:37 +00:00
Add quickfix to add a struct field
This commit is contained in:
parent
b56ad148db
commit
f5ac313000
5 changed files with 134 additions and 5 deletions
|
@ -75,6 +75,10 @@ pub fn record_field(name: ast::NameRef, expr: Option<ast::Expr>) -> ast::RecordF
|
|||
}
|
||||
}
|
||||
|
||||
pub fn record_field_def(name: ast::NameRef, ty: ast::TypeRef) -> ast::RecordFieldDef {
|
||||
ast_from_text(&format!("struct S {{ {}: {}, }}", name, ty))
|
||||
}
|
||||
|
||||
pub fn block_expr(
|
||||
stmts: impl IntoIterator<Item = ast::Stmt>,
|
||||
tail_expr: Option<ast::Expr>,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue