aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2020-06-18 11:41:37 +0100
committerGitHub <[email protected]>2020-06-18 11:41:37 +0100
commit0262dba97ef114bd7664a4e32be21caef2d63f0a (patch)
treebfa5465aa920ee4196ab1f39bf580701b2acf617
parent13adfedf8209d96e5a910d5e72d0de17462b23a6 (diff)
parent61a3f6d463eb10470206b72b4e796b3ff90da8c9 (diff)
Merge #4935
4935: Simplify r=matklad a=matklad bors r+ 🤖 Co-authored-by: Aleksey Kladov <[email protected]>
-rw-r--r--crates/rust-analyzer/src/global_state.rs4
-rw-r--r--crates/rust-analyzer/src/main_loop.rs10
2 files changed, 4 insertions, 10 deletions
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};
18use stdx::format_to; 18use stdx::format_to;
19 19
20use crate::{ 20use crate::{
21 config::Config, 21 config::{Config, FilesWatcher},
22 diagnostics::{CheckFixes, DiagnosticCollection}, 22 diagnostics::{CheckFixes, DiagnosticCollection},
23 main_loop::pending_requests::{CompletedRequest, LatestRequests}, 23 main_loop::pending_requests::{CompletedRequest, LatestRequests},
24 to_proto::url_from_abs_path, 24 to_proto::url_from_abs_path,
@@ -76,7 +76,6 @@ impl GlobalState {
76 workspaces: Vec<ProjectWorkspace>, 76 workspaces: Vec<ProjectWorkspace>,
77 lru_capacity: Option<usize>, 77 lru_capacity: Option<usize>,
78 exclude_globs: &[Glob], 78 exclude_globs: &[Glob],
79 watch: Watch,
80 config: Config, 79 config: Config,
81 ) -> GlobalState { 80 ) -> GlobalState {
82 let mut change = AnalysisChange::new(); 81 let mut change = AnalysisChange::new();
@@ -111,6 +110,7 @@ impl GlobalState {
111 110
112 let (task_sender, task_receiver) = unbounded(); 111 let (task_sender, task_receiver) = unbounded();
113 let task_sender = Box::new(move |t| task_sender.send(t).unwrap()); 112 let task_sender = Box::new(move |t| task_sender.send(t).unwrap());
113 let watch = Watch(matches!(config.files.watcher, FilesWatcher::Notify));
114 let (mut vfs, vfs_roots) = Vfs::new(roots, task_sender, watch); 114 let (mut vfs, vfs_roots) = Vfs::new(roots, task_sender, watch);
115 115
116 let mut extern_source_roots = FxHashMap::default(); 116 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};
27use ra_ide::{Canceled, FileId, LineIndex}; 27use ra_ide::{Canceled, FileId, LineIndex};
28use ra_prof::profile; 28use ra_prof::profile;
29use ra_project_model::{PackageRoot, ProjectWorkspace}; 29use ra_project_model::{PackageRoot, ProjectWorkspace};
30use ra_vfs::{VfsTask, Watch}; 30use ra_vfs::VfsTask;
31use rustc_hash::FxHashSet; 31use rustc_hash::FxHashSet;
32use serde::{de::DeserializeOwned, Serialize}; 32use serde::{de::DeserializeOwned, Serialize};
33use threadpool::ThreadPool; 33use threadpool::ThreadPool;
@@ -160,13 +160,7 @@ pub fn main_loop(config: Config, connection: Connection) -> Result<()> {
160 connection.sender.send(request.into()).unwrap(); 160 connection.sender.send(request.into()).unwrap();
161 } 161 }
162 162
163 GlobalState::new( 163 GlobalState::new(workspaces, config.lru_capacity, &globs, config)
164 workspaces,
165 config.lru_capacity,
166 &globs,
167 Watch(matches!(config.files.watcher, FilesWatcher::Notify)),
168 config,
169 )
170 }; 164 };
171 165
172 loop_state.roots_total = global_state.vfs.read().n_roots(); 166 loop_state.roots_total = global_state.vfs.read().n_roots();