aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_syntax/src/ast
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2020-07-14 12:37:28 +0100
committerGitHub <[email protected]>2020-07-14 12:37:28 +0100
commit83271f9b9977267492a59c4264fbd7dff9f7ea02 (patch)
tree65ab2157e01a6d86861b60ab40bc8f12d46d80a5 /crates/ra_syntax/src/ast
parent395e1d7d48276281c69d77fcdf26013dc6ae152d (diff)
parent85f5cbc9dc7027f922198f6c2d06cf382aad6970 (diff)
Merge #5367
5367: missing impl members: remove assoc. type bounds r=matklad a=jonas-schievink Previously "Add missing impl members" would paste bounds on associated types into the impl, which is not allowed. This removes them before pasting the item. Co-authored-by: Jonas Schievink <[email protected]>
Diffstat (limited to 'crates/ra_syntax/src/ast')
-rw-r--r--crates/ra_syntax/src/ast/edit.rs15
1 files changed, 15 insertions, 0 deletions
diff --git a/crates/ra_syntax/src/ast/edit.rs b/crates/ra_syntax/src/ast/edit.rs
index 940c30c7f..abc7a646c 100644
--- a/crates/ra_syntax/src/ast/edit.rs
+++ b/crates/ra_syntax/src/ast/edit.rs
@@ -189,6 +189,21 @@ impl ast::RecordFieldList {
189 } 189 }
190} 190}
191 191
192impl ast::TypeAliasDef {
193 #[must_use]
194 pub fn remove_bounds(&self) -> ast::TypeAliasDef {
195 let colon = match self.colon_token() {
196 Some(it) => it,
197 None => return self.clone(),
198 };
199 let end = match self.type_bound_list() {
200 Some(it) => it.syntax().clone().into(),
201 None => colon.clone().into(),
202 };
203 self.replace_children(colon.into()..=end, iter::empty())
204 }
205}
206
192impl ast::TypeParam { 207impl ast::TypeParam {
193 #[must_use] 208 #[must_use]
194 pub fn remove_bounds(&self) -> ast::TypeParam { 209 pub fn remove_bounds(&self) -> ast::TypeParam {