X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=crates%2Frust-analyzer%2Fsrc%2Fmain_loop.rs;h=0518a17f3073885f31ce24d23dadd67a9a9b02c7;hb=410679285b3dcad6e4610813a74615f8dc11d74d;hp=8aaca47160386b730cd436088f4741a64e83769e;hpb=f0db648cb6785930fa4027fc941c0f1692b5ad59;p=rust.git diff --git a/crates/rust-analyzer/src/main_loop.rs b/crates/rust-analyzer/src/main_loop.rs index 8aaca471603..0518a17f307 100644 --- a/crates/rust-analyzer/src/main_loop.rs +++ b/crates/rust-analyzer/src/main_loop.rs @@ -17,11 +17,11 @@ use crate::{ config::Config, dispatch::{NotificationDispatcher, RequestDispatcher}, - document::DocumentData, from_proto, global_state::{file_id_to_url, url_to_file_id, GlobalState}, handlers, lsp_ext, lsp_utils::{apply_document_changes, is_cancelled, notification_is, Progress}, + mem_docs::DocumentData, reload::{BuildDataProgress, ProjectWorkspaceProgress}, Result, }; @@ -305,7 +305,7 @@ fn handle_event(&mut self, event: Event) -> Result<()> { let vfs = &mut self.vfs.write().0; for (path, contents) in files { let path = VfsPath::from(path); - if !self.mem_docs.contains_key(&path) { + if !self.mem_docs.contains(&path) { vfs.set_file_contents(path, contents); } } @@ -582,7 +582,7 @@ fn on_notification(&mut self, not: Notification) -> Result<()> { if this .mem_docs .insert(path.clone(), DocumentData::new(params.text_document.version)) - .is_some() + .is_err() { log::error!("duplicate DidOpenTextDocument: {}", path) } @@ -628,7 +628,7 @@ fn on_notification(&mut self, not: Notification) -> Result<()> { })? .on::(|this, params| { if let Ok(path) = from_proto::vfs_path(¶ms.text_document.uri) { - if this.mem_docs.remove(&path).is_none() { + if this.mem_docs.remove(&path).is_err() { log::error!("orphan DidCloseTextDocument: {}", path); } @@ -719,7 +719,7 @@ fn update_file_notifications_on_threadpool(&mut self) { fn maybe_update_diagnostics(&mut self) { let subscriptions = self .mem_docs - .keys() + .iter() .map(|path| self.vfs.read().0.file_id(path).unwrap()) .collect::>();