aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_assists
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2019-04-11 13:51:02 +0100
committerAleksey Kladov <[email protected]>2019-04-11 14:29:33 +0100
commitb6809b6695f9c4cec82ff98d73f7ff24f96cbecf (patch)
treedd095e6ef28971355b4553a91c081a340f5defa1 /crates/ra_assists
parent6c2ba945ed331f0ce95eddd5b2183aa6fdf0f94b (diff)
rename
Diffstat (limited to 'crates/ra_assists')
-rw-r--r--crates/ra_assists/src/add_explicit_type.rs2
-rw-r--r--crates/ra_assists/src/add_missing_impl_members.rs6
-rw-r--r--crates/ra_assists/src/fill_match_arms.rs2
-rw-r--r--crates/ra_assists/src/fill_struct_fields.rs2
4 files changed, 6 insertions, 6 deletions
diff --git a/crates/ra_assists/src/add_explicit_type.rs b/crates/ra_assists/src/add_explicit_type.rs
index c50db4e21..c3674ffdc 100644
--- a/crates/ra_assists/src/add_explicit_type.rs
+++ b/crates/ra_assists/src/add_explicit_type.rs
@@ -29,7 +29,7 @@ pub(crate) fn add_explicit_type(mut ctx: AssistCtx<impl HirDatabase>) -> Option<
29 } 29 }
30 // Infer type 30 // Infer type
31 let db = ctx.db; 31 let db = ctx.db;
32 let analyzer = hir::SourceAnalyser::new(db, ctx.frange.file_id, stmt.syntax()); 32 let analyzer = hir::SourceAnalyzer::new(db, ctx.frange.file_id, stmt.syntax());
33 let ty = analyzer.type_of(db, expr)?; 33 let ty = analyzer.type_of(db, expr)?;
34 // Assist not applicable if the type is unknown 34 // Assist not applicable if the type is unknown
35 if is_unknown(&ty) { 35 if is_unknown(&ty) {
diff --git a/crates/ra_assists/src/add_missing_impl_members.rs b/crates/ra_assists/src/add_missing_impl_members.rs
index 0b2127e11..04b3f3c76 100644
--- a/crates/ra_assists/src/add_missing_impl_members.rs
+++ b/crates/ra_assists/src/add_missing_impl_members.rs
@@ -45,7 +45,7 @@ fn add_missing_impl_members_inner(
45 let trait_def = { 45 let trait_def = {
46 let file_id = ctx.frange.file_id; 46 let file_id = ctx.frange.file_id;
47 let position = FilePosition { file_id, offset: impl_node.syntax().range().start() }; 47 let position = FilePosition { file_id, offset: impl_node.syntax().range().start() };
48 let analyser = hir::SourceAnalyser::new(ctx.db, position.file_id, impl_node.syntax()); 48 let analyser = hir::SourceAnalyzer::new(ctx.db, position.file_id, impl_node.syntax());
49 49
50 resolve_target_trait_def(ctx.db, &analyser, impl_node)? 50 resolve_target_trait_def(ctx.db, &analyser, impl_node)?
51 }; 51 };
@@ -121,13 +121,13 @@ fn add_missing_impl_members_inner(
121/// implemented) to a `ast::TraitDef`. 121/// implemented) to a `ast::TraitDef`.
122fn resolve_target_trait_def( 122fn resolve_target_trait_def(
123 db: &impl HirDatabase, 123 db: &impl HirDatabase,
124 binder: &hir::SourceAnalyser, 124 analyzer: &hir::SourceAnalyzer,
125 impl_block: &ast::ImplBlock, 125 impl_block: &ast::ImplBlock,
126) -> Option<TreeArc<ast::TraitDef>> { 126) -> Option<TreeArc<ast::TraitDef>> {
127 let ast_path = 127 let ast_path =
128 impl_block.target_trait().map(AstNode::syntax).and_then(ast::PathType::cast)?.path()?; 128 impl_block.target_trait().map(AstNode::syntax).and_then(ast::PathType::cast)?.path()?;
129 129
130 match binder.resolve_path(db, &ast_path) { 130 match analyzer.resolve_path(db, &ast_path) {
131 Some(hir::PathResolution::Def(hir::ModuleDef::Trait(def))) => Some(def.source(db).1), 131 Some(hir::PathResolution::Def(hir::ModuleDef::Trait(def))) => Some(def.source(db).1),
132 _ => None, 132 _ => None,
133 } 133 }
diff --git a/crates/ra_assists/src/fill_match_arms.rs b/crates/ra_assists/src/fill_match_arms.rs
index 050b1c73f..8110b2676 100644
--- a/crates/ra_assists/src/fill_match_arms.rs
+++ b/crates/ra_assists/src/fill_match_arms.rs
@@ -20,7 +20,7 @@ pub(crate) fn fill_match_arms(mut ctx: AssistCtx<impl HirDatabase>) -> Option<As
20 } 20 }
21 21
22 let expr = match_expr.expr()?; 22 let expr = match_expr.expr()?;
23 let analyzer = hir::SourceAnalyser::new(ctx.db, ctx.frange.file_id, expr.syntax()); 23 let analyzer = hir::SourceAnalyzer::new(ctx.db, ctx.frange.file_id, expr.syntax());
24 let match_expr_ty = analyzer.type_of(ctx.db, expr)?; 24 let match_expr_ty = analyzer.type_of(ctx.db, expr)?;
25 let enum_def = match_expr_ty.autoderef(ctx.db).find_map(|ty| match ty.as_adt() { 25 let enum_def = match_expr_ty.autoderef(ctx.db).find_map(|ty| match ty.as_adt() {
26 Some((AdtDef::Enum(e), _)) => Some(e), 26 Some((AdtDef::Enum(e), _)) => Some(e),
diff --git a/crates/ra_assists/src/fill_struct_fields.rs b/crates/ra_assists/src/fill_struct_fields.rs
index e23cccbb8..81f762e8d 100644
--- a/crates/ra_assists/src/fill_struct_fields.rs
+++ b/crates/ra_assists/src/fill_struct_fields.rs
@@ -51,7 +51,7 @@ where
51 } 51 }
52 52
53 fn evaluate_struct_def_fields(&mut self) -> Option<()> { 53 fn evaluate_struct_def_fields(&mut self) -> Option<()> {
54 let analyzer = hir::SourceAnalyser::new( 54 let analyzer = hir::SourceAnalyzer::new(
55 self.ctx.db, 55 self.ctx.db,
56 self.ctx.frange.file_id, 56 self.ctx.frange.file_id,
57 self.struct_lit.syntax(), 57 self.struct_lit.syntax(),