aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_assists/src/ast_transform.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_assists/src/ast_transform.rs')
-rw-r--r--crates/ra_assists/src/ast_transform.rs16
1 files changed, 11 insertions, 5 deletions
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> {
79 }; 79 };
80 80
81 // FIXME: It would probably be nicer if we could get this via HIR (i.e. get the 81 // FIXME: It would probably be nicer if we could get this via HIR (i.e. get the
82 // trait ref, and then go from the types in the substs back to the syntax) 82 // trait ref, and then go from the types in the substs back to the syntax).
83 fn get_syntactic_substs(impl_def: ast::Impl) -> Option<Vec<ast::Type>> { 83 fn get_syntactic_substs(impl_def: ast::Impl) -> Option<Vec<ast::Type>> {
84 let target_trait = impl_def.target_trait()?; 84 let target_trait = impl_def.target_trait()?;
85 let path_type = match target_trait { 85 let path_type = match target_trait {
86 ast::Type::PathType(path) => path, 86 ast::Type::PathType(path) => path,
87 _ => return None, 87 _ => return None,
88 }; 88 };
89 let type_arg_list = path_type.path()?.segment()?.generic_arg_list()?; 89 let generic_arg_list = path_type.path()?.segment()?.generic_arg_list()?;
90
90 let mut result = Vec::new(); 91 let mut result = Vec::new();
91 for type_arg in type_arg_list.type_args() { 92 for generic_arg in generic_arg_list.generic_args() {
92 let type_arg: ast::TypeArg = type_arg; 93 match generic_arg {
93 result.push(type_arg.ty()?); 94 ast::GenericArg::TypeArg(type_arg) => result.push(type_arg.ty()?),
95 ast::GenericArg::AssocTypeArg(_)
96 | ast::GenericArg::LifetimeArg(_)
97 | ast::GenericArg::ConstArg(_) => (),
98 }
94 } 99 }
100
95 Some(result) 101 Some(result)
96 } 102 }
97 } 103 }