aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2019-08-19 12:27:15 +0100
committerAleksey Kladov <[email protected]>2019-08-19 12:27:15 +0100
commitdb84437d6f3e9b764907e67d31d5c78c69309b31 (patch)
tree983a31a82fdc2e9e7694ff718dbfd434c4196587
parentdf6dce23a7d1a87617939fb9bd61a4d65933cef5 (diff)
qualify ast types with `ast::`
By convention, ast nodes should always be used as `ast::FnDef`. This is to avoid confusion with similarly-named hir types.
-rw-r--r--crates/ra_ide_api/src/inlay_hints.rs19
1 files changed, 8 insertions, 11 deletions
diff --git a/crates/ra_ide_api/src/inlay_hints.rs b/crates/ra_ide_api/src/inlay_hints.rs
index 058cd68e2..735f3166c 100644
--- a/crates/ra_ide_api/src/inlay_hints.rs
+++ b/crates/ra_ide_api/src/inlay_hints.rs
@@ -2,11 +2,8 @@ use crate::{db::RootDatabase, FileId};
2use hir::{HirDisplay, SourceAnalyzer, Ty}; 2use hir::{HirDisplay, SourceAnalyzer, Ty};
3use ra_syntax::{ 3use ra_syntax::{
4 algo::visit::{visitor, Visitor}, 4 algo::visit::{visitor, Visitor},
5 ast::{ 5 ast::{self, AstNode, TypeAscriptionOwner},
6 self, AstNode, ForExpr, IfExpr, LambdaExpr, LetStmt, MatchArmList, SourceFile, 6 SmolStr, SourceFile, SyntaxKind, SyntaxNode, TextRange,
7 TypeAscriptionOwner, WhileExpr,
8 },
9 SmolStr, SyntaxKind, SyntaxNode, TextRange,
10}; 7};
11 8
12#[derive(Debug, PartialEq, Eq)] 9#[derive(Debug, PartialEq, Eq)]
@@ -35,7 +32,7 @@ fn get_inlay_hints(
35 node: &SyntaxNode, 32 node: &SyntaxNode,
36) -> Option<Vec<InlayHint>> { 33) -> Option<Vec<InlayHint>> {
37 visitor() 34 visitor()
38 .visit(|let_statement: LetStmt| { 35 .visit(|let_statement: ast::LetStmt| {
39 if let_statement.ascribed_type().is_some() { 36 if let_statement.ascribed_type().is_some() {
40 return None; 37 return None;
41 } 38 }
@@ -43,7 +40,7 @@ fn get_inlay_hints(
43 let analyzer = SourceAnalyzer::new(db, file_id, let_statement.syntax(), None); 40 let analyzer = SourceAnalyzer::new(db, file_id, let_statement.syntax(), None);
44 Some(get_pat_type_hints(db, &analyzer, pat, false)) 41 Some(get_pat_type_hints(db, &analyzer, pat, false))
45 }) 42 })
46 .visit(|closure_parameter: LambdaExpr| { 43 .visit(|closure_parameter: ast::LambdaExpr| {
47 let analyzer = SourceAnalyzer::new(db, file_id, closure_parameter.syntax(), None); 44 let analyzer = SourceAnalyzer::new(db, file_id, closure_parameter.syntax(), None);
48 closure_parameter.param_list().map(|param_list| { 45 closure_parameter.param_list().map(|param_list| {
49 param_list 46 param_list
@@ -55,22 +52,22 @@ fn get_inlay_hints(
55 .collect() 52 .collect()
56 }) 53 })
57 }) 54 })
58 .visit(|for_expression: ForExpr| { 55 .visit(|for_expression: ast::ForExpr| {
59 let pat = for_expression.pat()?; 56 let pat = for_expression.pat()?;
60 let analyzer = SourceAnalyzer::new(db, file_id, for_expression.syntax(), None); 57 let analyzer = SourceAnalyzer::new(db, file_id, for_expression.syntax(), None);
61 Some(get_pat_type_hints(db, &analyzer, pat, false)) 58 Some(get_pat_type_hints(db, &analyzer, pat, false))
62 }) 59 })
63 .visit(|if_expr: IfExpr| { 60 .visit(|if_expr: ast::IfExpr| {
64 let pat = if_expr.condition()?.pat()?; 61 let pat = if_expr.condition()?.pat()?;
65 let analyzer = SourceAnalyzer::new(db, file_id, if_expr.syntax(), None); 62 let analyzer = SourceAnalyzer::new(db, file_id, if_expr.syntax(), None);
66 Some(get_pat_type_hints(db, &analyzer, pat, true)) 63 Some(get_pat_type_hints(db, &analyzer, pat, true))
67 }) 64 })
68 .visit(|while_expr: WhileExpr| { 65 .visit(|while_expr: ast::WhileExpr| {
69 let pat = while_expr.condition()?.pat()?; 66 let pat = while_expr.condition()?.pat()?;
70 let analyzer = SourceAnalyzer::new(db, file_id, while_expr.syntax(), None); 67 let analyzer = SourceAnalyzer::new(db, file_id, while_expr.syntax(), None);
71 Some(get_pat_type_hints(db, &analyzer, pat, true)) 68 Some(get_pat_type_hints(db, &analyzer, pat, true))
72 }) 69 })
73 .visit(|match_arm_list: MatchArmList| { 70 .visit(|match_arm_list: ast::MatchArmList| {
74 let analyzer = SourceAnalyzer::new(db, file_id, match_arm_list.syntax(), None); 71 let analyzer = SourceAnalyzer::new(db, file_id, match_arm_list.syntax(), None);
75 Some( 72 Some(
76 match_arm_list 73 match_arm_list