From bb298158ebc7fc62cad1654c76dc582e6dc28f05 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 15 Oct 2018 20:15:53 +0300 Subject: migrate analysis and server to 2018 --- crates/ra_analysis/Cargo.toml | 1 + crates/ra_analysis/src/db/imp.rs | 4 ++-- crates/ra_analysis/src/db/mod.rs | 6 +++--- crates/ra_analysis/src/descriptors.rs | 4 ++-- crates/ra_analysis/src/imp.rs | 4 ++-- crates/ra_analysis/src/lib.rs | 8 +++++--- crates/ra_analysis/src/module_map.rs | 4 ++-- crates/ra_analysis/src/queries.rs | 4 ++-- crates/ra_analysis/src/roots.rs | 12 ++++++------ crates/ra_analysis/src/symbol_index.rs | 2 +- 10 files changed, 26 insertions(+), 23 deletions(-) (limited to 'crates/ra_analysis') diff --git a/crates/ra_analysis/Cargo.toml b/crates/ra_analysis/Cargo.toml index a82e1761c..28d95c581 100644 --- a/crates/ra_analysis/Cargo.toml +++ b/crates/ra_analysis/Cargo.toml @@ -1,4 +1,5 @@ [package] +edition = "2018" name = "ra_analysis" version = "0.1.0" authors = ["Aleksey Kladov "] diff --git a/crates/ra_analysis/src/db/imp.rs b/crates/ra_analysis/src/db/imp.rs index 36f6cf290..7669b6184 100644 --- a/crates/ra_analysis/src/db/imp.rs +++ b/crates/ra_analysis/src/db/imp.rs @@ -7,7 +7,7 @@ use std::{ }; use rustc_hash::FxHashMap; use salsa; -use {FileId, imp::FileResolverImp}; +use crate::{FileId, imp::FileResolverImp}; use super::{State, Query, QueryCtx}; pub(super) type Data = Arc; @@ -51,7 +51,7 @@ pub(crate) trait EvalQuery { type Output; fn query_type(&self) -> salsa::QueryTypeId; fn f(&self) -> salsa::QueryFn; - fn get(&self, &QueryCtx, Self::Params) -> Arc; + fn get(&self, ctx: &QueryCtx, params: Self::Params) -> Arc; } impl EvalQuery for Query diff --git a/crates/ra_analysis/src/db/mod.rs b/crates/ra_analysis/src/db/mod.rs index 22769d112..4eb7d922d 100644 --- a/crates/ra_analysis/src/db/mod.rs +++ b/crates/ra_analysis/src/db/mod.rs @@ -5,7 +5,7 @@ use std::{ }; use im; use salsa; -use {FileId, imp::FileResolverImp}; +use crate::{FileId, imp::FileResolverImp}; #[derive(Debug, Default, Clone)] pub(crate) struct State { @@ -75,8 +75,8 @@ pub(crate) fn file_set(ctx: QueryCtx) -> Arc<(Vec, FileResolverImp)> { impl QueryRegistry { fn new() -> QueryRegistry { let mut reg = QueryRegistry { imp: imp::QueryRegistry::new() }; - ::queries::register_queries(&mut reg); - ::module_map::register_queries(&mut reg); + crate::queries::register_queries(&mut reg); + crate::module_map::register_queries(&mut reg); reg } pub(crate) fn add(&mut self, q: Q, name: &'static str) { diff --git a/crates/ra_analysis/src/descriptors.rs b/crates/ra_analysis/src/descriptors.rs index faf945a41..f26dac875 100644 --- a/crates/ra_analysis/src/descriptors.rs +++ b/crates/ra_analysis/src/descriptors.rs @@ -7,7 +7,7 @@ use ra_syntax::{ ast::{self, NameOwner, AstNode}, text_utils::is_subrange }; -use { +use crate::{ FileId, imp::FileResolverImp, }; @@ -271,4 +271,4 @@ impl FnDescriptor { } res } -} \ No newline at end of file +} diff --git a/crates/ra_analysis/src/imp.rs b/crates/ra_analysis/src/imp.rs index aad54b977..26f5e175b 100644 --- a/crates/ra_analysis/src/imp.rs +++ b/crates/ra_analysis/src/imp.rs @@ -17,7 +17,7 @@ use ra_syntax::{ ast::{self, NameOwner, ArgListOwner, Expr}, }; -use { +use crate::{ FileId, FileResolver, Query, Diagnostic, SourceChange, SourceFileEdit, Position, FileSystemEdit, JobToken, CrateGraph, CrateId, roots::{SourceRoot, ReadonlySourceRoot, WritableSourceRoot}, @@ -458,4 +458,4 @@ impl<'a> FnCallNode<'a> { FnCallNode::MethodCallExpr(expr) => expr.arg_list() } } -} \ No newline at end of file +} diff --git a/crates/ra_analysis/src/lib.rs b/crates/ra_analysis/src/lib.rs index 1aca72ae0..86c66236c 100644 --- a/crates/ra_analysis/src/lib.rs +++ b/crates/ra_analysis/src/lib.rs @@ -29,16 +29,18 @@ use std::{ use relative_path::{RelativePath, RelativePathBuf}; use ra_syntax::{File, TextRange, TextUnit, AtomEdit}; -use imp::{AnalysisImpl, AnalysisHostImpl, FileResolverImp}; use rustc_hash::FxHashMap; +use crate::imp::{AnalysisImpl, AnalysisHostImpl, FileResolverImp}; pub use ra_editor::{ StructureNode, LineIndex, FileSymbol, Runnable, RunnableKind, HighlightedRange, CompletionItem, Fold, FoldKind }; -pub use job::{JobToken, JobHandle}; -pub use descriptors::FnDescriptor; +pub use crate::{ + job::{JobToken, JobHandle}, + descriptors::FnDescriptor, +}; #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] pub struct FileId(pub u32); diff --git a/crates/ra_analysis/src/module_map.rs b/crates/ra_analysis/src/module_map.rs index a21f55fff..c77c5cec6 100644 --- a/crates/ra_analysis/src/module_map.rs +++ b/crates/ra_analysis/src/module_map.rs @@ -1,5 +1,5 @@ use std::sync::Arc; -use { +use crate::{ FileId, db::{ Query, QueryRegistry, QueryCtx, @@ -38,7 +38,7 @@ mod tests { use std::collections::HashMap; use im; use relative_path::{RelativePath, RelativePathBuf}; - use { + use crate::{ db::{Db}, imp::FileResolverImp, FileId, FileResolver, diff --git a/crates/ra_analysis/src/queries.rs b/crates/ra_analysis/src/queries.rs index 062a2f420..613bf1e61 100644 --- a/crates/ra_analysis/src/queries.rs +++ b/crates/ra_analysis/src/queries.rs @@ -1,13 +1,13 @@ use std::sync::Arc; use ra_syntax::File; use ra_editor::LineIndex; -use { +use crate::{ FileId, db::{Query, QueryCtx, QueryRegistry}, symbol_index::SymbolIndex, }; -pub(crate) use db::{file_text, file_set}; +pub(crate) use crate::db::{file_text, file_set}; pub(crate) fn file_syntax(ctx: QueryCtx, file_id: FileId) -> File { (&*ctx.get(FILE_SYNTAX, file_id)).clone() diff --git a/crates/ra_analysis/src/roots.rs b/crates/ra_analysis/src/roots.rs index 32a8c5bd0..208acc4c2 100644 --- a/crates/ra_analysis/src/roots.rs +++ b/crates/ra_analysis/src/roots.rs @@ -9,7 +9,7 @@ use rustc_hash::FxHashMap; use ra_editor::LineIndex; use ra_syntax::File; -use { +use crate::{ FileId, imp::FileResolverImp, symbol_index::SymbolIndex, @@ -62,23 +62,23 @@ impl WritableSourceRoot { impl SourceRoot for WritableSourceRoot { fn module_tree(&self) -> Arc { - self.db.make_query(::module_map::module_tree) + self.db.make_query(crate::module_map::module_tree) } fn contains(&self, file_id: FileId) -> bool { self.db.state().file_map.contains_key(&file_id) } fn lines(&self, file_id: FileId) -> Arc { - self.db.make_query(|ctx| ::queries::file_lines(ctx, file_id)) + self.db.make_query(|ctx| crate::queries::file_lines(ctx, file_id)) } fn syntax(&self, file_id: FileId) -> File { - self.db.make_query(|ctx| ::queries::file_syntax(ctx, file_id)) + self.db.make_query(|ctx| crate::queries::file_syntax(ctx, file_id)) } fn symbols<'a>(&'a self, acc: &mut Vec>) { self.db.make_query(|ctx| { - let file_set = ::queries::file_set(ctx); + let file_set = crate::queries::file_set(ctx); let syms = file_set.0.iter() - .map(|file_id| ::queries::file_symbols(ctx, *file_id)); + .map(|file_id| crate::queries::file_symbols(ctx, *file_id)); acc.extend(syms); }); } diff --git a/crates/ra_analysis/src/symbol_index.rs b/crates/ra_analysis/src/symbol_index.rs index ffbb6a29f..e5d83d365 100644 --- a/crates/ra_analysis/src/symbol_index.rs +++ b/crates/ra_analysis/src/symbol_index.rs @@ -9,7 +9,7 @@ use ra_syntax::{ }; use fst::{self, Streamer}; use rayon::prelude::*; -use {Query, FileId, JobToken}; +use crate::{Query, FileId, JobToken}; #[derive(Debug)] pub(crate) struct SymbolIndex { -- cgit v1.2.3