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/path.rs | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) (limited to 'crates/ra_hir/src/path.rs') diff --git a/crates/ra_hir/src/path.rs b/crates/ra_hir/src/path.rs index 9e449f6cc..a61161b63 100644 --- a/crates/ra_hir/src/path.rs +++ b/crates/ra_hir/src/path.rs @@ -234,7 +234,7 @@ impl GenericArgs { } if let Some(ret_type) = ret_type { let type_ref = TypeRef::from_ast_opt(ret_type.type_ref()); - bindings.push((name::OUTPUT, type_ref)) + bindings.push((name::OUTPUT_TYPE, type_ref)) } if args.is_empty() && bindings.is_empty() { None @@ -338,3 +338,31 @@ fn convert_path(prefix: Option, path: ast::Path) -> Option { }; Some(res) } + +pub mod known { + use super::{Path, PathKind}; + use crate::name; + + pub fn std_iter_into_iterator() -> Path { + Path::from_simple_segments( + PathKind::Abs, + vec![name::STD, name::ITER, name::INTO_ITERATOR_TYPE], + ) + } + + pub fn std_ops_try() -> Path { + Path::from_simple_segments(PathKind::Abs, vec![name::STD, name::OPS, name::TRY_TYPE]) + } + + pub fn std_result_result() -> Path { + Path::from_simple_segments(PathKind::Abs, vec![name::STD, name::RESULT, name::RESULT_TYPE]) + } + + pub fn std_future_future() -> Path { + Path::from_simple_segments(PathKind::Abs, vec![name::STD, name::FUTURE, name::FUTURE_TYPE]) + } + + pub fn std_boxed_box() -> Path { + Path::from_simple_segments(PathKind::Abs, vec![name::STD, name::BOXED, name::BOX_TYPE]) + } +} -- cgit v1.2.3