From 61a3f6d463eb10470206b72b4e796b3ff90da8c9 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 18 Jun 2020 12:39:41 +0200 Subject: Simplify --- crates/rust-analyzer/src/global_state.rs | 4 ++-- crates/rust-analyzer/src/main_loop.rs | 10 ++-------- 2 files changed, 4 insertions(+), 10 deletions(-) (limited to 'crates') diff --git a/crates/rust-analyzer/src/global_state.rs b/crates/rust-analyzer/src/global_state.rs index ca95d776a..1527c9947 100644 --- a/crates/rust-analyzer/src/global_state.rs +++ b/crates/rust-analyzer/src/global_state.rs @@ -18,7 +18,7 @@ use ra_vfs::{LineEndings, RootEntry, Vfs, VfsChange, VfsFile, VfsTask, Watch}; use stdx::format_to; use crate::{ - config::Config, + config::{Config, FilesWatcher}, diagnostics::{CheckFixes, DiagnosticCollection}, main_loop::pending_requests::{CompletedRequest, LatestRequests}, to_proto::url_from_abs_path, @@ -76,7 +76,6 @@ impl GlobalState { workspaces: Vec, lru_capacity: Option, exclude_globs: &[Glob], - watch: Watch, config: Config, ) -> GlobalState { let mut change = AnalysisChange::new(); @@ -111,6 +110,7 @@ impl GlobalState { let (task_sender, task_receiver) = unbounded(); let task_sender = Box::new(move |t| task_sender.send(t).unwrap()); + let watch = Watch(matches!(config.files.watcher, FilesWatcher::Notify)); let (mut vfs, vfs_roots) = Vfs::new(roots, task_sender, watch); let mut extern_source_roots = FxHashMap::default(); diff --git a/crates/rust-analyzer/src/main_loop.rs b/crates/rust-analyzer/src/main_loop.rs index 08b0a5a16..f0aaaa21e 100644 --- a/crates/rust-analyzer/src/main_loop.rs +++ b/crates/rust-analyzer/src/main_loop.rs @@ -27,7 +27,7 @@ use ra_flycheck::{CheckTask, Status}; use ra_ide::{Canceled, FileId, LineIndex}; use ra_prof::profile; use ra_project_model::{PackageRoot, ProjectWorkspace}; -use ra_vfs::{VfsTask, Watch}; +use ra_vfs::VfsTask; use rustc_hash::FxHashSet; use serde::{de::DeserializeOwned, Serialize}; use threadpool::ThreadPool; @@ -160,13 +160,7 @@ pub fn main_loop(config: Config, connection: Connection) -> Result<()> { connection.sender.send(request.into()).unwrap(); } - GlobalState::new( - workspaces, - config.lru_capacity, - &globs, - Watch(matches!(config.files.watcher, FilesWatcher::Notify)), - config, - ) + GlobalState::new(workspaces, config.lru_capacity, &globs, config) }; loop_state.roots_total = global_state.vfs.read().n_roots(); -- cgit v1.2.3