mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-26 13:03:31 +00:00
Merge #3705
3705: Align naming r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
This commit is contained in:
commit
7c2cc85806
3 changed files with 5 additions and 5 deletions
|
@ -151,7 +151,7 @@ fn add_missing_impl_members_inner(
|
||||||
ast::ImplItem::FnDef(def) => ast::ImplItem::FnDef(add_body(def)),
|
ast::ImplItem::FnDef(def) => ast::ImplItem::FnDef(add_body(def)),
|
||||||
_ => it,
|
_ => it,
|
||||||
})
|
})
|
||||||
.map(|it| edit::strip_attrs_and_docs(&it));
|
.map(|it| edit::remove_attrs_and_docs(&it));
|
||||||
let new_impl_item_list = impl_item_list.append_items(items);
|
let new_impl_item_list = impl_item_list.append_items(items);
|
||||||
let cursor_position = {
|
let cursor_position = {
|
||||||
let first_new_item = new_impl_item_list.impl_items().nth(n_existing_items).unwrap();
|
let first_new_item = new_impl_item_list.impl_items().nth(n_existing_items).unwrap();
|
||||||
|
|
|
@ -193,7 +193,7 @@ fn add_const_impl(
|
||||||
}
|
}
|
||||||
|
|
||||||
fn make_const_compl_syntax(const_: &ast::ConstDef) -> String {
|
fn make_const_compl_syntax(const_: &ast::ConstDef) -> String {
|
||||||
let const_ = edit::strip_attrs_and_docs(const_);
|
let const_ = edit::remove_attrs_and_docs(const_);
|
||||||
|
|
||||||
let const_start = const_.syntax().text_range().start();
|
let const_start = const_.syntax().text_range().start();
|
||||||
let const_end = const_.syntax().text_range().end();
|
let const_end = const_.syntax().text_range().end();
|
||||||
|
|
|
@ -296,11 +296,11 @@ impl ast::UseTree {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[must_use]
|
#[must_use]
|
||||||
pub fn strip_attrs_and_docs<N: ast::AttrsOwner>(node: &N) -> N {
|
pub fn remove_attrs_and_docs<N: ast::AttrsOwner>(node: &N) -> N {
|
||||||
N::cast(strip_attrs_and_docs_inner(node.syntax().clone())).unwrap()
|
N::cast(remove_attrs_and_docs_inner(node.syntax().clone())).unwrap()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn strip_attrs_and_docs_inner(mut node: SyntaxNode) -> SyntaxNode {
|
fn remove_attrs_and_docs_inner(mut node: SyntaxNode) -> SyntaxNode {
|
||||||
while let Some(start) =
|
while let Some(start) =
|
||||||
node.children_with_tokens().find(|it| it.kind() == ATTR || it.kind() == COMMENT)
|
node.children_with_tokens().find(|it| it.kind() == ATTR || it.kind() == COMMENT)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue