aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_assists
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_assists')
-rw-r--r--crates/ra_assists/Cargo.toml1
-rw-r--r--crates/ra_assists/src/ast_transform.rs21
2 files changed, 12 insertions, 10 deletions
diff --git a/crates/ra_assists/Cargo.toml b/crates/ra_assists/Cargo.toml
index 488ab7bc8..3bcf58ba4 100644
--- a/crates/ra_assists/Cargo.toml
+++ b/crates/ra_assists/Cargo.toml
@@ -21,5 +21,4 @@ ra_prof = { path = "../ra_prof" }
21ra_db = { path = "../ra_db" } 21ra_db = { path = "../ra_db" }
22ra_ide_db = { path = "../ra_ide_db" } 22ra_ide_db = { path = "../ra_ide_db" }
23hir = { path = "../ra_hir", package = "ra_hir" } 23hir = { path = "../ra_hir", package = "ra_hir" }
24hir_def = { path = "../ra_hir_def", package = "ra_hir_def" }
25test_utils = { path = "../test_utils" } 24test_utils = { path = "../test_utils" }
diff --git a/crates/ra_assists/src/ast_transform.rs b/crates/ra_assists/src/ast_transform.rs
index d81218bc8..4001ca73c 100644
--- a/crates/ra_assists/src/ast_transform.rs
+++ b/crates/ra_assists/src/ast_transform.rs
@@ -1,8 +1,7 @@
1//! `AstTransformer`s are functions that replace nodes in an AST and can be easily combined. 1//! `AstTransformer`s are functions that replace nodes in an AST and can be easily combined.
2use rustc_hash::FxHashMap; 2use rustc_hash::FxHashMap;
3 3
4use hir::{PathResolution, SemanticsScope}; 4use hir::{HirDisplay, PathResolution, SemanticsScope};
5use hir_def::type_ref::TypeRef;
6use ra_ide_db::RootDatabase; 5use ra_ide_db::RootDatabase;
7use ra_syntax::{ 6use ra_syntax::{
8 algo::SyntaxRewriter, 7 algo::SyntaxRewriter,
@@ -61,14 +60,18 @@ impl<'a> SubstituteTypeParams<'a> {
61 .zip(substs.into_iter().map(Some).chain(std::iter::repeat(None))) 60 .zip(substs.into_iter().map(Some).chain(std::iter::repeat(None)))
62 .filter_map(|(k, v)| match v { 61 .filter_map(|(k, v)| match v {
63 Some(v) => Some((k, v)), 62 Some(v) => Some((k, v)),
64 None => match k.default(source_scope.db)? { 63 None => {
65 TypeRef::Path(path) => Some(( 64 let default = k.default(source_scope.db)?;
65 Some((
66 k, 66 k,
67 ast::make::type_arg(&format!("{}", path.mod_path().as_ident()?)) 67 ast::make::type_arg(
68 .type_ref()?, 68 &default
69 )), 69 .display_source_code(source_scope.db, source_scope.module()?.into())
70 _ => None, 70 .ok()?,
71 }, 71 )
72 .type_ref()?,
73 ))
74 }
72 }) 75 })
73 .collect(); 76 .collect();
74 return SubstituteTypeParams { 77 return SubstituteTypeParams {