diff options
Diffstat (limited to 'crates/ra_assists/src/ast_editor.rs')
-rw-r--r-- | crates/ra_assists/src/ast_editor.rs | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/crates/ra_assists/src/ast_editor.rs b/crates/ra_assists/src/ast_editor.rs index 076df98f2..6815638dc 100644 --- a/crates/ra_assists/src/ast_editor.rs +++ b/crates/ra_assists/src/ast_editor.rs | |||
@@ -93,15 +93,15 @@ impl<N: AstNode> AstEditor<N> { | |||
93 | } | 93 | } |
94 | } | 94 | } |
95 | 95 | ||
96 | impl AstEditor<ast::NamedFieldList> { | 96 | impl AstEditor<ast::RecordFieldList> { |
97 | pub fn append_field(&mut self, field: &ast::NamedField) { | 97 | pub fn append_field(&mut self, field: &ast::RecordField) { |
98 | self.insert_field(InsertPosition::Last, field) | 98 | self.insert_field(InsertPosition::Last, field) |
99 | } | 99 | } |
100 | 100 | ||
101 | pub fn insert_field( | 101 | pub fn insert_field( |
102 | &mut self, | 102 | &mut self, |
103 | position: InsertPosition<&'_ ast::NamedField>, | 103 | position: InsertPosition<&'_ ast::RecordField>, |
104 | field: &ast::NamedField, | 104 | field: &ast::RecordField, |
105 | ) { | 105 | ) { |
106 | let is_multiline = self.ast().syntax().text().contains_char('\n'); | 106 | let is_multiline = self.ast().syntax().text().contains_char('\n'); |
107 | let ws; | 107 | let ws; |
@@ -245,16 +245,16 @@ pub struct AstBuilder<N: AstNode> { | |||
245 | _phantom: std::marker::PhantomData<N>, | 245 | _phantom: std::marker::PhantomData<N>, |
246 | } | 246 | } |
247 | 247 | ||
248 | impl AstBuilder<ast::NamedField> { | 248 | impl AstBuilder<ast::RecordField> { |
249 | pub fn from_name(name: &Name) -> ast::NamedField { | 249 | pub fn from_name(name: &Name) -> ast::RecordField { |
250 | ast_node_from_file_text(&format!("fn f() {{ S {{ {}: (), }} }}", name)) | 250 | ast_node_from_file_text(&format!("fn f() {{ S {{ {}: (), }} }}", name)) |
251 | } | 251 | } |
252 | 252 | ||
253 | fn from_text(text: &str) -> ast::NamedField { | 253 | fn from_text(text: &str) -> ast::RecordField { |
254 | ast_node_from_file_text(&format!("fn f() {{ S {{ {}, }} }}", text)) | 254 | ast_node_from_file_text(&format!("fn f() {{ S {{ {}, }} }}", text)) |
255 | } | 255 | } |
256 | 256 | ||
257 | pub fn from_pieces(name: &ast::NameRef, expr: Option<&ast::Expr>) -> ast::NamedField { | 257 | pub fn from_pieces(name: &ast::NameRef, expr: Option<&ast::Expr>) -> ast::RecordField { |
258 | match expr { | 258 | match expr { |
259 | Some(expr) => Self::from_text(&format!("{}: {}", name.syntax(), expr.syntax())), | 259 | Some(expr) => Self::from_text(&format!("{}: {}", name.syntax(), expr.syntax())), |
260 | None => Self::from_text(&name.syntax().to_string()), | 260 | None => Self::from_text(&name.syntax().to_string()), |
@@ -336,12 +336,12 @@ impl AstBuilder<ast::TupleStructPat> { | |||
336 | } | 336 | } |
337 | } | 337 | } |
338 | 338 | ||
339 | impl AstBuilder<ast::StructPat> { | 339 | impl AstBuilder<ast::RecordPat> { |
340 | fn from_text(text: &str) -> ast::StructPat { | 340 | fn from_text(text: &str) -> ast::RecordPat { |
341 | ast_node_from_file_text(&format!("fn f({}: ())", text)) | 341 | ast_node_from_file_text(&format!("fn f({}: ())", text)) |
342 | } | 342 | } |
343 | 343 | ||
344 | pub fn from_pieces(path: &ast::Path, pats: impl Iterator<Item = ast::Pat>) -> ast::StructPat { | 344 | pub fn from_pieces(path: &ast::Path, pats: impl Iterator<Item = ast::Pat>) -> ast::RecordPat { |
345 | let pats_str = pats.map(|p| p.syntax().to_string()).collect::<Vec<_>>().join(", "); | 345 | let pats_str = pats.map(|p| p.syntax().to_string()).collect::<Vec<_>>().join(", "); |
346 | Self::from_text(&format!("{}{{ {} }}", path.syntax(), pats_str)) | 346 | Self::from_text(&format!("{}{{ {} }}", path.syntax(), pats_str)) |
347 | } | 347 | } |