From 91781c7ce8201b28afd56b4e35eba47e076a8498 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Fri, 31 Jul 2020 18:29:29 +0200 Subject: Rename TypeArgList -> GenericArgList --- crates/ra_assists/src/ast_transform.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'crates/ra_assists/src') diff --git a/crates/ra_assists/src/ast_transform.rs b/crates/ra_assists/src/ast_transform.rs index 3265bd406..e23331773 100644 --- a/crates/ra_assists/src/ast_transform.rs +++ b/crates/ra_assists/src/ast_transform.rs @@ -86,7 +86,7 @@ impl<'a> SubstituteTypeParams<'a> { ast::Type::PathType(path) => path, _ => return None, }; - let type_arg_list = path_type.path()?.segment()?.type_arg_list()?; + let type_arg_list = path_type.path()?.segment()?.generic_arg_list()?; let mut result = Vec::new(); for type_arg in type_arg_list.type_args() { let type_arg: ast::TypeArg = type_arg; @@ -157,7 +157,7 @@ impl<'a> QualifyPaths<'a> { let type_args = p .segment() - .and_then(|s| s.type_arg_list()) + .and_then(|s| s.generic_arg_list()) .map(|arg_list| apply(self, arg_list)); if let Some(type_args) = type_args { let last_segment = path.segment().unwrap(); -- cgit v1.2.3 From 040b4c800d5279e77a6825fc90cb2921d26c7f95 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Fri, 31 Jul 2020 18:41:37 +0200 Subject: Fix GenericArgs grammar --- crates/ra_assists/src/ast_transform.rs | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'crates/ra_assists/src') diff --git a/crates/ra_assists/src/ast_transform.rs b/crates/ra_assists/src/ast_transform.rs index e23331773..0a7be87a0 100644 --- a/crates/ra_assists/src/ast_transform.rs +++ b/crates/ra_assists/src/ast_transform.rs @@ -79,19 +79,25 @@ impl<'a> SubstituteTypeParams<'a> { }; // FIXME: It would probably be nicer if we could get this via HIR (i.e. get the - // trait ref, and then go from the types in the substs back to the syntax) + // trait ref, and then go from the types in the substs back to the syntax). fn get_syntactic_substs(impl_def: ast::Impl) -> Option> { let target_trait = impl_def.target_trait()?; let path_type = match target_trait { ast::Type::PathType(path) => path, _ => return None, }; - let type_arg_list = path_type.path()?.segment()?.generic_arg_list()?; + let generic_arg_list = path_type.path()?.segment()?.generic_arg_list()?; + let mut result = Vec::new(); - for type_arg in type_arg_list.type_args() { - let type_arg: ast::TypeArg = type_arg; - result.push(type_arg.ty()?); + for generic_arg in generic_arg_list.generic_args() { + match generic_arg { + ast::GenericArg::TypeArg(type_arg) => result.push(type_arg.ty()?), + ast::GenericArg::AssocTypeArg(_) + | ast::GenericArg::LifetimeArg(_) + | ast::GenericArg::ConstArg(_) => (), + } } + Some(result) } } -- cgit v1.2.3