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.
This commit is contained in:
parent
df6dce23a7
commit
db84437d6f
1 changed files with 8 additions and 11 deletions
|
@ -2,11 +2,8 @@ use crate::{db::RootDatabase, FileId};
|
||||||
use hir::{HirDisplay, SourceAnalyzer, Ty};
|
use hir::{HirDisplay, SourceAnalyzer, Ty};
|
||||||
use ra_syntax::{
|
use ra_syntax::{
|
||||||
algo::visit::{visitor, Visitor},
|
algo::visit::{visitor, Visitor},
|
||||||
ast::{
|
ast::{self, AstNode, TypeAscriptionOwner},
|
||||||
self, AstNode, ForExpr, IfExpr, LambdaExpr, LetStmt, MatchArmList, SourceFile,
|
SmolStr, SourceFile, SyntaxKind, SyntaxNode, TextRange,
|
||||||
TypeAscriptionOwner, WhileExpr,
|
|
||||||
},
|
|
||||||
SmolStr, SyntaxKind, SyntaxNode, TextRange,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#[derive(Debug, PartialEq, Eq)]
|
#[derive(Debug, PartialEq, Eq)]
|
||||||
|
@ -35,7 +32,7 @@ fn get_inlay_hints(
|
||||||
node: &SyntaxNode,
|
node: &SyntaxNode,
|
||||||
) -> Option<Vec<InlayHint>> {
|
) -> Option<Vec<InlayHint>> {
|
||||||
visitor()
|
visitor()
|
||||||
.visit(|let_statement: LetStmt| {
|
.visit(|let_statement: ast::LetStmt| {
|
||||||
if let_statement.ascribed_type().is_some() {
|
if let_statement.ascribed_type().is_some() {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
|
@ -43,7 +40,7 @@ fn get_inlay_hints(
|
||||||
let analyzer = SourceAnalyzer::new(db, file_id, let_statement.syntax(), None);
|
let analyzer = SourceAnalyzer::new(db, file_id, let_statement.syntax(), None);
|
||||||
Some(get_pat_type_hints(db, &analyzer, pat, false))
|
Some(get_pat_type_hints(db, &analyzer, pat, false))
|
||||||
})
|
})
|
||||||
.visit(|closure_parameter: LambdaExpr| {
|
.visit(|closure_parameter: ast::LambdaExpr| {
|
||||||
let analyzer = SourceAnalyzer::new(db, file_id, closure_parameter.syntax(), None);
|
let analyzer = SourceAnalyzer::new(db, file_id, closure_parameter.syntax(), None);
|
||||||
closure_parameter.param_list().map(|param_list| {
|
closure_parameter.param_list().map(|param_list| {
|
||||||
param_list
|
param_list
|
||||||
|
@ -55,22 +52,22 @@ fn get_inlay_hints(
|
||||||
.collect()
|
.collect()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
.visit(|for_expression: ForExpr| {
|
.visit(|for_expression: ast::ForExpr| {
|
||||||
let pat = for_expression.pat()?;
|
let pat = for_expression.pat()?;
|
||||||
let analyzer = SourceAnalyzer::new(db, file_id, for_expression.syntax(), None);
|
let analyzer = SourceAnalyzer::new(db, file_id, for_expression.syntax(), None);
|
||||||
Some(get_pat_type_hints(db, &analyzer, pat, false))
|
Some(get_pat_type_hints(db, &analyzer, pat, false))
|
||||||
})
|
})
|
||||||
.visit(|if_expr: IfExpr| {
|
.visit(|if_expr: ast::IfExpr| {
|
||||||
let pat = if_expr.condition()?.pat()?;
|
let pat = if_expr.condition()?.pat()?;
|
||||||
let analyzer = SourceAnalyzer::new(db, file_id, if_expr.syntax(), None);
|
let analyzer = SourceAnalyzer::new(db, file_id, if_expr.syntax(), None);
|
||||||
Some(get_pat_type_hints(db, &analyzer, pat, true))
|
Some(get_pat_type_hints(db, &analyzer, pat, true))
|
||||||
})
|
})
|
||||||
.visit(|while_expr: WhileExpr| {
|
.visit(|while_expr: ast::WhileExpr| {
|
||||||
let pat = while_expr.condition()?.pat()?;
|
let pat = while_expr.condition()?.pat()?;
|
||||||
let analyzer = SourceAnalyzer::new(db, file_id, while_expr.syntax(), None);
|
let analyzer = SourceAnalyzer::new(db, file_id, while_expr.syntax(), None);
|
||||||
Some(get_pat_type_hints(db, &analyzer, pat, true))
|
Some(get_pat_type_hints(db, &analyzer, pat, true))
|
||||||
})
|
})
|
||||||
.visit(|match_arm_list: MatchArmList| {
|
.visit(|match_arm_list: ast::MatchArmList| {
|
||||||
let analyzer = SourceAnalyzer::new(db, file_id, match_arm_list.syntax(), None);
|
let analyzer = SourceAnalyzer::new(db, file_id, match_arm_list.syntax(), None);
|
||||||
Some(
|
Some(
|
||||||
match_arm_list
|
match_arm_list
|
||||||
|
|
Loading…
Add table
Reference in a new issue