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_lsp_server/Cargo.toml | 1 + crates/ra_lsp_server/src/conv.rs | 6 +++--- crates/ra_lsp_server/src/lib.rs | 6 ++++-- crates/ra_lsp_server/src/main_loop/handlers.rs | 2 +- crates/ra_lsp_server/src/main_loop/mod.rs | 2 +- crates/ra_lsp_server/src/project_model.rs | 2 +- crates/ra_lsp_server/src/server_world.rs | 2 +- crates/ra_lsp_server/src/thread_watcher.rs | 2 +- crates/ra_lsp_server/src/vfs.rs | 2 +- crates/ra_lsp_server/tests/heavy_tests/main.rs | 2 +- crates/ra_lsp_server/tests/heavy_tests/support.rs | 2 +- 11 files changed, 16 insertions(+), 13 deletions(-) (limited to 'crates/ra_lsp_server') diff --git a/crates/ra_lsp_server/Cargo.toml b/crates/ra_lsp_server/Cargo.toml index 1fe6b2ebe..2b3257117 100644 --- a/crates/ra_lsp_server/Cargo.toml +++ b/crates/ra_lsp_server/Cargo.toml @@ -1,4 +1,5 @@ [package] +edition = "2018" name = "ra_lsp_server" version = "0.1.0" authors = ["Aleksey Kladov "] diff --git a/crates/ra_lsp_server/src/conv.rs b/crates/ra_lsp_server/src/conv.rs index 08a656569..a75b160c5 100644 --- a/crates/ra_lsp_server/src/conv.rs +++ b/crates/ra_lsp_server/src/conv.rs @@ -7,7 +7,7 @@ use ra_editor::{LineIndex, LineCol, Edit, AtomEdit}; use ra_syntax::{SyntaxKind, TextUnit, TextRange}; use ra_analysis::{FileId, SourceChange, SourceFileEdit, FileSystemEdit}; -use { +use crate::{ Result, server_world::ServerWorld, req, @@ -299,7 +299,7 @@ pub fn to_location( Ok(loc) } -pub trait MapConvWith<'a>: Sized { +pub trait MapConvWith<'a>: Sized + 'a { type Ctx; type Output; @@ -309,7 +309,7 @@ pub trait MapConvWith<'a>: Sized { } impl<'a, I> MapConvWith<'a> for I - where I: Iterator, + where I: Iterator + 'a, I::Item: ConvWith { type Ctx = ::Ctx; diff --git a/crates/ra_lsp_server/src/lib.rs b/crates/ra_lsp_server/src/lib.rs index 60652d55e..7224b1476 100644 --- a/crates/ra_lsp_server/src/lib.rs +++ b/crates/ra_lsp_server/src/lib.rs @@ -34,5 +34,7 @@ mod project_model; pub mod thread_watcher; pub type Result = ::std::result::Result; -pub use caps::server_capabilities; -pub use main_loop::main_loop; +pub use crate::{ + main_loop::main_loop, + caps::server_capabilities, +}; diff --git a/crates/ra_lsp_server/src/main_loop/handlers.rs b/crates/ra_lsp_server/src/main_loop/handlers.rs index f65e2a889..1fe78f3d0 100644 --- a/crates/ra_lsp_server/src/main_loop/handlers.rs +++ b/crates/ra_lsp_server/src/main_loop/handlers.rs @@ -13,7 +13,7 @@ use ra_syntax::{ text_utils::contains_offset_nonstrict }; -use ::{ +use crate::{ req::{self, Decoration}, Result, conv::{Conv, ConvWith, TryConvWith, MapConvWith, to_location}, server_world::ServerWorld, diff --git a/crates/ra_lsp_server/src/main_loop/mod.rs b/crates/ra_lsp_server/src/main_loop/mod.rs index f4e7cfc33..773501efe 100644 --- a/crates/ra_lsp_server/src/main_loop/mod.rs +++ b/crates/ra_lsp_server/src/main_loop/mod.rs @@ -16,7 +16,7 @@ use gen_lsp_server::{ }; use rustc_hash::FxHashMap; -use { +use crate::{ req, Result, vfs::{self, FileEvent}, diff --git a/crates/ra_lsp_server/src/project_model.rs b/crates/ra_lsp_server/src/project_model.rs index 43e4fd654..c144d9596 100644 --- a/crates/ra_lsp_server/src/project_model.rs +++ b/crates/ra_lsp_server/src/project_model.rs @@ -5,7 +5,7 @@ use rustc_hash::{FxHashMap, FxHashSet}; use cargo_metadata::{metadata_run, CargoOpt}; use ra_syntax::SmolStr; -use { +use crate::{ Result, thread_watcher::{Worker, ThreadWatcher}, }; diff --git a/crates/ra_lsp_server/src/server_world.rs b/crates/ra_lsp_server/src/server_world.rs index c4cdf83d4..c931afa02 100644 --- a/crates/ra_lsp_server/src/server_world.rs +++ b/crates/ra_lsp_server/src/server_world.rs @@ -8,7 +8,7 @@ use rustc_hash::FxHashMap; use languageserver_types::Url; use ra_analysis::{FileId, AnalysisHost, Analysis, CrateGraph, CrateId, LibraryData, FileResolver}; -use { +use crate::{ Result, path_map::{PathMap, Root}, vfs::{FileEvent, FileEventKind}, diff --git a/crates/ra_lsp_server/src/thread_watcher.rs b/crates/ra_lsp_server/src/thread_watcher.rs index 86a3a91e0..3257effcb 100644 --- a/crates/ra_lsp_server/src/thread_watcher.rs +++ b/crates/ra_lsp_server/src/thread_watcher.rs @@ -1,7 +1,7 @@ use std::thread; use crossbeam_channel::{bounded, unbounded, Sender, Receiver}; use drop_bomb::DropBomb; -use Result; +use crate::Result; pub struct Worker { pub inp: Sender, diff --git a/crates/ra_lsp_server/src/vfs.rs b/crates/ra_lsp_server/src/vfs.rs index a1c1783f2..d8f9b1aac 100644 --- a/crates/ra_lsp_server/src/vfs.rs +++ b/crates/ra_lsp_server/src/vfs.rs @@ -5,7 +5,7 @@ use std::{ use walkdir::WalkDir; -use { +use crate::{ thread_watcher::{Worker, ThreadWatcher}, }; diff --git a/crates/ra_lsp_server/tests/heavy_tests/main.rs b/crates/ra_lsp_server/tests/heavy_tests/main.rs index dced45f55..7265b5999 100644 --- a/crates/ra_lsp_server/tests/heavy_tests/main.rs +++ b/crates/ra_lsp_server/tests/heavy_tests/main.rs @@ -12,7 +12,7 @@ mod support; use ra_lsp_server::req::{Runnables, RunnablesParams}; -use support::project; +use crate::support::project; const LOG: &'static str = ""; diff --git a/crates/ra_lsp_server/tests/heavy_tests/support.rs b/crates/ra_lsp_server/tests/heavy_tests/support.rs index 8fe2aa816..d1339f62f 100644 --- a/crates/ra_lsp_server/tests/heavy_tests/support.rs +++ b/crates/ra_lsp_server/tests/heavy_tests/support.rs @@ -25,7 +25,7 @@ use ra_lsp_server::{main_loop, req, thread_watcher::{ThreadWatcher, Worker}}; pub fn project(fixture: &str) -> Server { static INIT: Once = Once::new(); - INIT.call_once(|| Logger::with_env_or_str(::LOG).start().unwrap()); + INIT.call_once(|| Logger::with_env_or_str(crate::LOG).start().unwrap()); let tmp_dir = TempDir::new("test-project") .unwrap(); -- cgit v1.2.3