10734: fix: add generic parameters in convert to manual impl assist r=Veykril a=TheDoctor314

Fixes #10041.

Co-authored-by: TheDoctor314 <64731940+TheDoctor314@users.noreply.github.com>
This commit is contained in:
bors[bot] 2021-11-16 11:27:11 +00:00 committed by GitHub
commit 6c7be6cd84
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 74 additions and 4 deletions

View file

@ -149,8 +149,13 @@ pub fn impl_(
ast_from_text(&format!("impl{} {}{} {{}}", params, ty, ty_params))
}
pub fn impl_trait(trait_: ast::Path, ty: ast::Path) -> ast::Impl {
ast_from_text(&format!("impl {} for {} {{}}", trait_, ty))
pub fn impl_trait(
trait_: ast::Path,
ty: ast::Path,
ty_params: Option<ast::GenericParamList>,
) -> ast::Impl {
let ty_params = ty_params.map_or_else(String::new, |params| params.to_string());
ast_from_text(&format!("impl{2} {} for {}{2} {{}}", trait_, ty, ty_params))
}
pub(crate) fn generic_arg_list() -> ast::GenericArgList {