aboutsummaryrefslogtreecommitdiff
path: root/crates/rust-analyzer/src/global_state.rs
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2021-01-06 12:46:31 +0000
committerAleksey Kladov <[email protected]>2021-01-06 12:46:31 +0000
commit66ed821e18eadd3930a8621095c90b142763d517 (patch)
tree8fb1eb11fa56bf7d9669ef195c1baaa1e3eb2fdc /crates/rust-analyzer/src/global_state.rs
parentf7a15b5cd1df58e46066bbd27c90cb1ad7f9c316 (diff)
Speed up snapshoting
Config can be fairly big, no need to deep clone it frequently
Diffstat (limited to 'crates/rust-analyzer/src/global_state.rs')
-rw-r--r--crates/rust-analyzer/src/global_state.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/crates/rust-analyzer/src/global_state.rs b/crates/rust-analyzer/src/global_state.rs
index 19ab4d596..1f6bf1c8c 100644
--- a/crates/rust-analyzer/src/global_state.rs
+++ b/crates/rust-analyzer/src/global_state.rs
@@ -67,7 +67,7 @@ pub(crate) struct GlobalState {
67 pub(crate) flycheck: Vec<FlycheckHandle>, 67 pub(crate) flycheck: Vec<FlycheckHandle>,
68 pub(crate) flycheck_sender: Sender<flycheck::Message>, 68 pub(crate) flycheck_sender: Sender<flycheck::Message>,
69 pub(crate) flycheck_receiver: Receiver<flycheck::Message>, 69 pub(crate) flycheck_receiver: Receiver<flycheck::Message>,
70 pub(crate) config: Config, 70 pub(crate) config: Arc<Config>,
71 pub(crate) analysis_host: AnalysisHost, 71 pub(crate) analysis_host: AnalysisHost,
72 pub(crate) diagnostics: DiagnosticCollection, 72 pub(crate) diagnostics: DiagnosticCollection,
73 pub(crate) mem_docs: FxHashMap<VfsPath, DocumentData>, 73 pub(crate) mem_docs: FxHashMap<VfsPath, DocumentData>,
@@ -83,7 +83,7 @@ pub(crate) struct GlobalState {
83 83
84/// An immutable snapshot of the world's state at a point in time. 84/// An immutable snapshot of the world's state at a point in time.
85pub(crate) struct GlobalStateSnapshot { 85pub(crate) struct GlobalStateSnapshot {
86 pub(crate) config: Config, 86 pub(crate) config: Arc<Config>,
87 pub(crate) analysis: Analysis, 87 pub(crate) analysis: Analysis,
88 pub(crate) check_fixes: CheckFixes, 88 pub(crate) check_fixes: CheckFixes,
89 pub(crate) latest_requests: Arc<RwLock<LatestRequests>>, 89 pub(crate) latest_requests: Arc<RwLock<LatestRequests>>,
@@ -119,7 +119,7 @@ impl GlobalState {
119 flycheck: Vec::new(), 119 flycheck: Vec::new(),
120 flycheck_sender, 120 flycheck_sender,
121 flycheck_receiver, 121 flycheck_receiver,
122 config, 122 config: Arc::new(config),
123 analysis_host, 123 analysis_host,
124 diagnostics: Default::default(), 124 diagnostics: Default::default(),
125 mem_docs: FxHashMap::default(), 125 mem_docs: FxHashMap::default(),
@@ -184,7 +184,7 @@ impl GlobalState {
184 184
185 pub(crate) fn snapshot(&self) -> GlobalStateSnapshot { 185 pub(crate) fn snapshot(&self) -> GlobalStateSnapshot {
186 GlobalStateSnapshot { 186 GlobalStateSnapshot {
187 config: self.config.clone(), 187 config: Arc::clone(&self.config),
188 workspaces: Arc::clone(&self.workspaces), 188 workspaces: Arc::clone(&self.workspaces),
189 analysis: self.analysis_host.analysis(), 189 analysis: self.analysis_host.analysis(),
190 vfs: Arc::clone(&self.vfs), 190 vfs: Arc::clone(&self.vfs),