Merge commit 'aa9bc86125' into sync-from-ra

This commit is contained in:
Laurențiu Nicola 2023-06-05 12:04:23 +03:00
parent 1570299af4
commit c48062fe2a
598 changed files with 57696 additions and 17615 deletions

View file

@ -236,6 +236,21 @@ impl ast::GenericParamList {
}
}
/// Removes the existing generic param
pub fn remove_generic_param(&self, generic_param: ast::GenericParam) {
if let Some(previous) = generic_param.syntax().prev_sibling() {
if let Some(next_token) = previous.next_sibling_or_token() {
ted::remove_all(next_token..=generic_param.syntax().clone().into());
}
} else if let Some(next) = generic_param.syntax().next_sibling() {
if let Some(next_token) = next.prev_sibling_or_token() {
ted::remove_all(generic_param.syntax().clone().into()..=next_token);
}
} else {
ted::remove(generic_param.syntax());
}
}
/// Constructs a matching [`ast::GenericArgList`]
pub fn to_generic_args(&self) -> ast::GenericArgList {
let args = self.generic_params().filter_map(|param| match param {
@ -465,6 +480,8 @@ impl ast::Impl {
}
impl ast::AssocItemList {
/// Attention! This function does align the first line of `item` with respect to `self`,
/// but it does _not_ change indentation of other lines (if any).
pub fn add_item(&self, item: ast::AssocItem) {
let (indent, position, whitespace) = match self.assoc_items().last() {
Some(last_item) => (