Add missing AssocItems in add_custom_impl assist

This commit is contained in:
Lukas Wirth 2020-11-05 23:34:50 +01:00
parent 7709b6a2d4
commit 19443c1fa3
5 changed files with 240 additions and 110 deletions

View file

@ -25,6 +25,10 @@ pub fn assoc_item_list() -> ast::AssocItemList {
ast_from_text("impl C for D {};")
}
pub fn impl_trait(trait_: ast::Path, ty: ast::Path) -> ast::Impl {
ast_from_text(&format!("impl {} for {} {{}}", trait_, ty))
}
pub fn path_segment(name_ref: ast::NameRef) -> ast::PathSegment {
ast_from_text(&format!("use {};", name_ref))
}