aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide_api/src
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2019-08-19 12:31:01 +0100
committerGitHub <[email protected]>2019-08-19 12:31:01 +0100
commitcef90ce45ee9954e864933450953f5eb83429f01 (patch)
tree983a31a82fdc2e9e7694ff718dbfd434c4196587 /crates/ra_ide_api/src
parent8704a74cd5d02ed4dfe897c12186af1c3ac697fa (diff)
parentdb84437d6f3e9b764907e67d31d5c78c69309b31 (diff)
Merge #1701
1701: qualify ast types with `ast::` r=matklad a=matklad (only the last commit is relevant, the rest are from #1700) bors r+ Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_ide_api/src')
-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