From 5f6f994256a4a91f1caba9cabfd7a4552180a9da Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Fri, 26 Jun 2020 00:54:41 +0200 Subject: Simplify --- crates/rust-analyzer/src/global_state.rs | 9 +++------ crates/rust-analyzer/src/main_loop.rs | 3 +-- 2 files changed, 4 insertions(+), 8 deletions(-) (limited to 'crates') diff --git a/crates/rust-analyzer/src/global_state.rs b/crates/rust-analyzer/src/global_state.rs index 17de2a075..a8cc71249 100644 --- a/crates/rust-analyzer/src/global_state.rs +++ b/crates/rust-analyzer/src/global_state.rs @@ -84,11 +84,7 @@ pub(crate) struct GlobalStateSnapshot { } impl GlobalState { - pub(crate) fn new( - sender: Sender, - lru_capacity: Option, - config: Config, - ) -> GlobalState { + pub(crate) fn new(sender: Sender, config: Config) -> GlobalState { let loader = { let (sender, receiver) = unbounded::(); let handle = @@ -103,12 +99,13 @@ impl GlobalState { Handle { handle, receiver } }; + let analysis_host = AnalysisHost::new(config.lru_capacity); GlobalState { sender, task_pool, loader, config, - analysis_host: AnalysisHost::new(lru_capacity), + analysis_host, flycheck: None, diagnostics: Default::default(), mem_docs: FxHashSet::default(), diff --git a/crates/rust-analyzer/src/main_loop.rs b/crates/rust-analyzer/src/main_loop.rs index d4879283d..d03c68edf 100644 --- a/crates/rust-analyzer/src/main_loop.rs +++ b/crates/rust-analyzer/src/main_loop.rs @@ -44,8 +44,7 @@ pub fn main_loop(config: Config, connection: Connection) -> Result<()> { SetThreadPriority(thread, thread_priority_above_normal); } - GlobalState::new(connection.sender.clone(), config.lru_capacity, config) - .run(connection.receiver) + GlobalState::new(connection.sender.clone(), config).run(connection.receiver) } enum Event { -- cgit v1.2.3