diff options
Diffstat (limited to 'crates/ra_syntax/src/ast/edit.rs')
-rw-r--r-- | crates/ra_syntax/src/ast/edit.rs | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/crates/ra_syntax/src/ast/edit.rs b/crates/ra_syntax/src/ast/edit.rs index d79310995..9e5411ee5 100644 --- a/crates/ra_syntax/src/ast/edit.rs +++ b/crates/ra_syntax/src/ast/edit.rs | |||
@@ -6,7 +6,7 @@ use std::{iter, ops::RangeInclusive}; | |||
6 | use arrayvec::ArrayVec; | 6 | use arrayvec::ArrayVec; |
7 | 7 | ||
8 | use crate::{ | 8 | use crate::{ |
9 | algo, | 9 | algo::{self, neighbor, SyntaxRewriter}, |
10 | ast::{ | 10 | ast::{ |
11 | self, | 11 | self, |
12 | make::{self, tokens}, | 12 | make::{self, tokens}, |
@@ -16,7 +16,6 @@ use crate::{ | |||
16 | SyntaxKind::{ATTR, COMMENT, WHITESPACE}, | 16 | SyntaxKind::{ATTR, COMMENT, WHITESPACE}, |
17 | SyntaxNode, SyntaxToken, T, | 17 | SyntaxNode, SyntaxToken, T, |
18 | }; | 18 | }; |
19 | use algo::{neighbor, SyntaxRewriter}; | ||
20 | 19 | ||
21 | impl ast::BinExpr { | 20 | impl ast::BinExpr { |
22 | #[must_use] | 21 | #[must_use] |
@@ -96,10 +95,10 @@ impl ast::ItemList { | |||
96 | leading_indent(it.syntax()).unwrap_or_default().to_string(), | 95 | leading_indent(it.syntax()).unwrap_or_default().to_string(), |
97 | InsertPosition::After(it.syntax().clone().into()), | 96 | InsertPosition::After(it.syntax().clone().into()), |
98 | ), | 97 | ), |
99 | None => match self.l_curly() { | 98 | None => match self.l_curly_token() { |
100 | Some(it) => ( | 99 | Some(it) => ( |
101 | " ".to_string() + &leading_indent(self.syntax()).unwrap_or_default(), | 100 | " ".to_string() + &leading_indent(self.syntax()).unwrap_or_default(), |
102 | InsertPosition::After(it.syntax().clone().into()), | 101 | InsertPosition::After(it.into()), |
103 | ), | 102 | ), |
104 | None => return self.clone(), | 103 | None => return self.clone(), |
105 | }, | 104 | }, |
@@ -142,8 +141,8 @@ impl ast::RecordFieldList { | |||
142 | 141 | ||
143 | macro_rules! after_l_curly { | 142 | macro_rules! after_l_curly { |
144 | () => {{ | 143 | () => {{ |
145 | let anchor = match self.l_curly() { | 144 | let anchor = match self.l_curly_token() { |
146 | Some(it) => it.syntax().clone().into(), | 145 | Some(it) => it.into(), |
147 | None => return self.clone(), | 146 | None => return self.clone(), |
148 | }; | 147 | }; |
149 | InsertPosition::After(anchor) | 148 | InsertPosition::After(anchor) |
@@ -190,15 +189,15 @@ impl ast::RecordFieldList { | |||
190 | impl ast::TypeParam { | 189 | impl ast::TypeParam { |
191 | #[must_use] | 190 | #[must_use] |
192 | pub fn remove_bounds(&self) -> ast::TypeParam { | 191 | pub fn remove_bounds(&self) -> ast::TypeParam { |
193 | let colon = match self.colon() { | 192 | let colon = match self.colon_token() { |
194 | Some(it) => it, | 193 | Some(it) => it, |
195 | None => return self.clone(), | 194 | None => return self.clone(), |
196 | }; | 195 | }; |
197 | let end = match self.type_bound_list() { | 196 | let end = match self.type_bound_list() { |
198 | Some(it) => it.syntax().clone().into(), | 197 | Some(it) => it.syntax().clone().into(), |
199 | None => colon.syntax().clone().into(), | 198 | None => colon.clone().into(), |
200 | }; | 199 | }; |
201 | self.replace_children(colon.syntax().clone().into()..=end, iter::empty()) | 200 | self.replace_children(colon.into()..=end, iter::empty()) |
202 | } | 201 | } |
203 | } | 202 | } |
204 | 203 | ||
@@ -301,7 +300,7 @@ impl ast::UseTree { | |||
301 | suffix.clone(), | 300 | suffix.clone(), |
302 | self.use_tree_list(), | 301 | self.use_tree_list(), |
303 | self.alias(), | 302 | self.alias(), |
304 | self.star().is_some(), | 303 | self.star_token().is_some(), |
305 | ); | 304 | ); |
306 | let nested = make::use_tree_list(iter::once(use_tree)); | 305 | let nested = make::use_tree_list(iter::once(use_tree)); |
307 | return make::use_tree(prefix.clone(), Some(nested), None, false); | 306 | return make::use_tree(prefix.clone(), Some(nested), None, false); |