From 4926bed42680d329f906be93450bec6b2ba0e99b Mon Sep 17 00:00:00 2001 From: uHOOCCOOHu Date: Thu, 12 Sep 2019 02:01:07 +0800 Subject: Support path starting with a type --- crates/ra_hir/src/expr/validation.rs | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'crates/ra_hir/src/expr/validation.rs') diff --git a/crates/ra_hir/src/expr/validation.rs b/crates/ra_hir/src/expr/validation.rs index 030ec53a2..c675bf8de 100644 --- a/crates/ra_hir/src/expr/validation.rs +++ b/crates/ra_hir/src/expr/validation.rs @@ -8,7 +8,7 @@ use crate::{ diagnostics::{DiagnosticSink, MissingFields, MissingOkInTailExpr}, expr::AstPtr, name, - path::{PathKind, PathSegment}, + path::PathKind, ty::{ApplicationTy, InferenceResult, Ty, TypeCtor}, Adt, Function, Name, Path, }; @@ -108,14 +108,10 @@ impl<'a, 'b> ExprValidator<'a, 'b> { None => return, }; - let std_result_path = Path { - kind: PathKind::Abs, - segments: vec![ - PathSegment { name: name::STD, args_and_bindings: None }, - PathSegment { name: name::RESULT_MOD, args_and_bindings: None }, - PathSegment { name: name::RESULT_TYPE, args_and_bindings: None }, - ], - }; + let std_result_path = Path::from_simple_segments( + PathKind::Abs, + vec![name::STD, name::RESULT_MOD, name::RESULT_TYPE], + ); let resolver = self.func.resolver(db); let std_result_enum = match resolver.resolve_known_enum(db, &std_result_path) { -- cgit v1.2.3 From 7ed3be32916facf3b709d5277381408cd3ec134a Mon Sep 17 00:00:00 2001 From: uHOOCCOOHu Date: Sun, 15 Sep 2019 20:14:33 +0800 Subject: Define known paths and group names --- crates/ra_hir/src/expr/validation.rs | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'crates/ra_hir/src/expr/validation.rs') diff --git a/crates/ra_hir/src/expr/validation.rs b/crates/ra_hir/src/expr/validation.rs index c675bf8de..f06e5ec07 100644 --- a/crates/ra_hir/src/expr/validation.rs +++ b/crates/ra_hir/src/expr/validation.rs @@ -7,8 +7,7 @@ use crate::{ db::HirDatabase, diagnostics::{DiagnosticSink, MissingFields, MissingOkInTailExpr}, expr::AstPtr, - name, - path::PathKind, + path::known, ty::{ApplicationTy, InferenceResult, Ty, TypeCtor}, Adt, Function, Name, Path, }; @@ -108,10 +107,7 @@ impl<'a, 'b> ExprValidator<'a, 'b> { None => return, }; - let std_result_path = Path::from_simple_segments( - PathKind::Abs, - vec![name::STD, name::RESULT_MOD, name::RESULT_TYPE], - ); + let std_result_path = known::std_result_result(); let resolver = self.func.resolver(db); let std_result_enum = match resolver.resolve_known_enum(db, &std_result_path) { -- cgit v1.2.3