From d898ecb8f2c19eb041bcb27c7ce9edd9d891f2c2 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sat, 16 Nov 2019 00:56:51 +0300 Subject: Force passing Source when creating a SourceAnalyzer --- crates/ra_ide_api/src/inlay_hints.rs | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'crates/ra_ide_api/src/inlay_hints.rs') 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( file_id: FileId, node: &SyntaxNode, ) -> Option> { + let analyzer = SourceAnalyzer::new(db, hir::Source::new(file_id.into(), node), None); match_ast! { match node { ast::LetStmt(it) => { @@ -39,11 +40,9 @@ fn get_inlay_hints( return None; } let pat = it.pat()?; - let analyzer = SourceAnalyzer::new(db, file_id, it.syntax(), None); Some(get_pat_type_hints(db, &analyzer, pat, false)) }, ast::LambdaExpr(it) => { - let analyzer = SourceAnalyzer::new(db, file_id, it.syntax(), None); it.param_list().map(|param_list| { param_list .params() @@ -56,21 +55,17 @@ fn get_inlay_hints( }, ast::ForExpr(it) => { let pat = it.pat()?; - let analyzer = SourceAnalyzer::new(db, file_id, it.syntax(), None); Some(get_pat_type_hints(db, &analyzer, pat, false)) }, ast::IfExpr(it) => { let pat = it.condition()?.pat()?; - let analyzer = SourceAnalyzer::new(db, file_id, it.syntax(), None); Some(get_pat_type_hints(db, &analyzer, pat, true)) }, ast::WhileExpr(it) => { let pat = it.condition()?.pat()?; - let analyzer = SourceAnalyzer::new(db, file_id, it.syntax(), None); Some(get_pat_type_hints(db, &analyzer, pat, true)) }, ast::MatchArmList(it) => { - let analyzer = SourceAnalyzer::new(db, file_id, it.syntax(), None); Some( it .arms() -- cgit v1.2.3