diff options
author | Seivan Heidari <[email protected]> | 2019-11-18 01:27:53 +0000 |
---|---|---|
committer | Seivan Heidari <[email protected]> | 2019-11-18 01:27:53 +0000 |
commit | 166636ba77adcf5bf2c4ef935e9aa75e20f25e10 (patch) | |
tree | 168be1ca55c73b016e20586c08417c608450c92c /crates/ra_ide_api/src/inlay_hints.rs | |
parent | cb26df950699586b314731fb70786e0db8eaa049 (diff) | |
parent | 28c2d74b2150102a8756a5357a5a965d7610bd15 (diff) |
Merge branch 'master' of https://github.com/rust-analyzer/rust-analyzer into feature/themes
Diffstat (limited to 'crates/ra_ide_api/src/inlay_hints.rs')
-rw-r--r-- | crates/ra_ide_api/src/inlay_hints.rs | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/crates/ra_ide_api/src/inlay_hints.rs b/crates/ra_ide_api/src/inlay_hints.rs index 2ff10b89a..0cd959848 100644 --- a/crates/ra_ide_api/src/inlay_hints.rs +++ b/crates/ra_ide_api/src/inlay_hints.rs | |||
@@ -32,6 +32,7 @@ fn get_inlay_hints( | |||
32 | file_id: FileId, | 32 | file_id: FileId, |
33 | node: &SyntaxNode, | 33 | node: &SyntaxNode, |
34 | ) -> Option<Vec<InlayHint>> { | 34 | ) -> Option<Vec<InlayHint>> { |
35 | let analyzer = SourceAnalyzer::new(db, hir::Source::new(file_id.into(), node), None); | ||
35 | match_ast! { | 36 | match_ast! { |
36 | match node { | 37 | match node { |
37 | ast::LetStmt(it) => { | 38 | ast::LetStmt(it) => { |
@@ -39,11 +40,9 @@ fn get_inlay_hints( | |||
39 | return None; | 40 | return None; |
40 | } | 41 | } |
41 | let pat = it.pat()?; | 42 | let pat = it.pat()?; |
42 | let analyzer = SourceAnalyzer::new(db, file_id, it.syntax(), None); | ||
43 | Some(get_pat_type_hints(db, &analyzer, pat, false)) | 43 | Some(get_pat_type_hints(db, &analyzer, pat, false)) |
44 | }, | 44 | }, |
45 | ast::LambdaExpr(it) => { | 45 | ast::LambdaExpr(it) => { |
46 | let analyzer = SourceAnalyzer::new(db, file_id, it.syntax(), None); | ||
47 | it.param_list().map(|param_list| { | 46 | it.param_list().map(|param_list| { |
48 | param_list | 47 | param_list |
49 | .params() | 48 | .params() |
@@ -56,21 +55,17 @@ fn get_inlay_hints( | |||
56 | }, | 55 | }, |
57 | ast::ForExpr(it) => { | 56 | ast::ForExpr(it) => { |
58 | let pat = it.pat()?; | 57 | let pat = it.pat()?; |
59 | let analyzer = SourceAnalyzer::new(db, file_id, it.syntax(), None); | ||
60 | Some(get_pat_type_hints(db, &analyzer, pat, false)) | 58 | Some(get_pat_type_hints(db, &analyzer, pat, false)) |
61 | }, | 59 | }, |
62 | ast::IfExpr(it) => { | 60 | ast::IfExpr(it) => { |
63 | let pat = it.condition()?.pat()?; | 61 | let pat = it.condition()?.pat()?; |
64 | let analyzer = SourceAnalyzer::new(db, file_id, it.syntax(), None); | ||
65 | Some(get_pat_type_hints(db, &analyzer, pat, true)) | 62 | Some(get_pat_type_hints(db, &analyzer, pat, true)) |
66 | }, | 63 | }, |
67 | ast::WhileExpr(it) => { | 64 | ast::WhileExpr(it) => { |
68 | let pat = it.condition()?.pat()?; | 65 | let pat = it.condition()?.pat()?; |
69 | let analyzer = SourceAnalyzer::new(db, file_id, it.syntax(), None); | ||
70 | Some(get_pat_type_hints(db, &analyzer, pat, true)) | 66 | Some(get_pat_type_hints(db, &analyzer, pat, true)) |
71 | }, | 67 | }, |
72 | ast::MatchArmList(it) => { | 68 | ast::MatchArmList(it) => { |
73 | let analyzer = SourceAnalyzer::new(db, file_id, it.syntax(), None); | ||
74 | Some( | 69 | Some( |
75 | it | 70 | it |
76 | .arms() | 71 | .arms() |