aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_syntax/src/ast/edit.rs
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2020-07-30 10:42:51 +0100
committerAleksey Kladov <[email protected]>2020-07-30 10:50:56 +0100
commit2984da672e0c73d56501c6b6e4d19fd28152b5eb (patch)
treeca9e499bd96c2273f90f27d43ba7282b5931f8df /crates/ra_syntax/src/ast/edit.rs
parent72ffd851dd5b0fcdf3aa072131ba11009878b4ae (diff)
Split ItemList & AssocItemList
Diffstat (limited to 'crates/ra_syntax/src/ast/edit.rs')
-rw-r--r--crates/ra_syntax/src/ast/edit.rs9
1 files changed, 6 insertions, 3 deletions
diff --git a/crates/ra_syntax/src/ast/edit.rs b/crates/ra_syntax/src/ast/edit.rs
index abc7a646c..01a310f66 100644
--- a/crates/ra_syntax/src/ast/edit.rs
+++ b/crates/ra_syntax/src/ast/edit.rs
@@ -80,9 +80,12 @@ where
80 } 80 }
81} 81}
82 82
83impl ast::ItemList { 83impl ast::AssocItemList {
84 #[must_use] 84 #[must_use]
85 pub fn append_items(&self, items: impl IntoIterator<Item = ast::AssocItem>) -> ast::ItemList { 85 pub fn append_items(
86 &self,
87 items: impl IntoIterator<Item = ast::AssocItem>,
88 ) -> ast::AssocItemList {
86 let mut res = self.clone(); 89 let mut res = self.clone();
87 if !self.syntax().text().contains_char('\n') { 90 if !self.syntax().text().contains_char('\n') {
88 res = make_multiline(res); 91 res = make_multiline(res);
@@ -92,7 +95,7 @@ impl ast::ItemList {
92 } 95 }
93 96
94 #[must_use] 97 #[must_use]
95 pub fn append_item(&self, item: ast::AssocItem) -> ast::ItemList { 98 pub fn append_item(&self, item: ast::AssocItem) -> ast::AssocItemList {
96 let (indent, position) = match self.assoc_items().last() { 99 let (indent, position) = match self.assoc_items().last() {
97 Some(it) => ( 100 Some(it) => (
98 leading_indent(it.syntax()).unwrap_or_default().to_string(), 101 leading_indent(it.syntax()).unwrap_or_default().to_string(),