add_missing_impl_members no longer breaks indentation

This commit is contained in:
ponyii 2023-05-08 22:26:50 +04:00
parent a0db4781dc
commit e07d6382de
3 changed files with 106 additions and 4 deletions

View file

@ -9,7 +9,7 @@ use stdx::format_to;
use syntax::{
ast::{
self,
edit::{self, AstNodeEdit},
edit::{AstNodeEdit, IndentLevel},
edit_in_place::{AttrsOwnerEdit, Removable},
make, HasArgList, HasAttrs, HasGenericParams, HasName, HasTypeBounds, Whitespace,
},
@ -154,7 +154,7 @@ pub fn add_trait_assoc_items_to_impl(
match &item {
ast::AssocItem::Fn(fn_) if fn_.body().is_none() => {
let body = make::block_expr(None, Some(make::ext::expr_todo()))
.indent(edit::IndentLevel(1));
.indent(IndentLevel::from_node(impl_.syntax()) + 1);
ted::replace(fn_.get_or_create_body().syntax(), body.clone_for_update().syntax())
}
ast::AssocItem::TypeAlias(type_alias) => {