From f5ac3130001ab7fe64dd542fd866a18012ee9971 Mon Sep 17 00:00:00 2001 From: Timo Freiberg Date: Tue, 9 Jun 2020 23:11:16 +0200 Subject: Add quickfix to add a struct field --- crates/ra_syntax/src/ast/make.rs | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'crates/ra_syntax') diff --git a/crates/ra_syntax/src/ast/make.rs b/crates/ra_syntax/src/ast/make.rs index da0eb0926..192c610f1 100644 --- a/crates/ra_syntax/src/ast/make.rs +++ b/crates/ra_syntax/src/ast/make.rs @@ -75,6 +75,10 @@ pub fn record_field(name: ast::NameRef, expr: Option) -> 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, tail_expr: Option, -- cgit v1.2.3